Hello,
I am still working on displaying statistics using dbman and I have one more question...
My goal now is to minimize the times that I call &query for a particular report. Let me explain with an example...
I have a select field called "Status" which can be filled with different items such as "OPEN, CLOSED, FINISHED, ANSWERED..".
One of my reports shows the number of records in all the possible statuses for a particular time frame (Lets say January).
Sooo, in order to accomplish this, I have set up a loop that goes through all the possible statuses (OPEN,CLOSED,...) and calls up &query as many times as different statuses there are. i.e.
$in{"Date"}="Jan";
$in{"Status"}="$WhateverStatusValue";
my ($status,@results) = &query('view');
Even though this method works now, it will obviously get slower and slower as more records are added hence my question:
Is there way I can just call &query with the "Date" once
$in{"Date"}="Jan";
my ($status,@results) = &query('view');
and go trough each of the records that resulted from the &query so that I can count how many are in all different statuses
foreach $rec (@rec) {
if ($rec{Status} eq "OPEN") { opencoutner++}
elseif ($rec{Status} eq "CLOSED"){ closedcoutner++}
....
}
or something like that...
Cheers
-JO
I am still working on displaying statistics using dbman and I have one more question...
My goal now is to minimize the times that I call &query for a particular report. Let me explain with an example...
I have a select field called "Status" which can be filled with different items such as "OPEN, CLOSED, FINISHED, ANSWERED..".
One of my reports shows the number of records in all the possible statuses for a particular time frame (Lets say January).
Sooo, in order to accomplish this, I have set up a loop that goes through all the possible statuses (OPEN,CLOSED,...) and calls up &query as many times as different statuses there are. i.e.
$in{"Date"}="Jan";
$in{"Status"}="$WhateverStatusValue";
my ($status,@results) = &query('view');
Even though this method works now, it will obviously get slower and slower as more records are added hence my question:
Is there way I can just call &query with the "Date" once
$in{"Date"}="Jan";
my ($status,@results) = &query('view');
and go trough each of the records that resulted from the &query so that I can count how many are in all different statuses
foreach $rec (@rec) {
if ($rec{Status} eq "OPEN") { opencoutner++}
elseif ($rec{Status} eq "CLOSED"){ closedcoutner++}
....
}
or something like that...
Cheers
-JO