I have the list category & give count mod up and working fine. However, no where in the mod does it allow for a "total count" after the list is made.
I spent the last couple of days reading about counts & experimenting. The most I could actually get it to do is print:
Total Count =
Here is the mod (notice the blue below):
------------------------------
The mod already lists the individual counts of each category (in my case it is called "symbol".
for ($i = 0; $i <= $#db_cols; $i++) {
#### In the line below, replace 'Category' with the name of your field.
if ($db_cols[$i] eq "Symbol" ) {
$fieldnum = $i; $found = 1;
last;
}
}
if ($found) {
open (DB, "<$db_file_name") or &cgierr("unable to open $db_file_name. Reason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB> ) {
next if /^#/;
next if /^\s*$/;
$line = $_;
chomp ($line);
@fields = &split_decode ($line);
++$count{$fields[$fieldnum]};
}
close DB;
#### In the line below, replace 'Category' with the name of your field.
@options = split (/\,/, $db_select_fields{'Symbol'});
foreach $option (sort @options) {
if ($count{$option}) {
$encoded = &urlencode($option);
#### In the line below, replace 'Category' with the name of your field.
print qq|
<TABLE WIDTH="20%" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#EDDCDC">
<tr> <td width="30%" align="left"><b><Font face="Verdana, Arial, Helvetica" Size="2"><a href="$db_script_link_url&Symbol=$encoded&view_records=1">$option</FONT></b></TD>
<td width="10%" align="center"><font face="Verdana, Arial, Helvetica" size="2"><b>$count{$option}</b></font></TD>
</TR>
</TABLE>
|;
}
}
}
# < -- End page text -->
&html_footer;
&html_page_bottom;
}
------------
Should I add code below that, such as:
++$total_count;
below the:
++$count{$fields[$fieldnum]};
and then add something like:
print|
There are $total_count symbols in the database.
;
}
Or, am I totally off base here? Thanks very much for your help.
Diana Rae
I spent the last couple of days reading about counts & experimenting. The most I could actually get it to do is print:
Total Count =
Here is the mod (notice the blue below):
------------------------------
The mod already lists the individual counts of each category (in my case it is called "symbol".
for ($i = 0; $i <= $#db_cols; $i++) {
#### In the line below, replace 'Category' with the name of your field.
if ($db_cols[$i] eq "Symbol" ) {
$fieldnum = $i; $found = 1;
last;
}
}
if ($found) {
open (DB, "<$db_file_name") or &cgierr("unable to open $db_file_name. Reason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB> ) {
next if /^#/;
next if /^\s*$/;
$line = $_;
chomp ($line);
@fields = &split_decode ($line);
++$count{$fields[$fieldnum]};
}
close DB;
#### In the line below, replace 'Category' with the name of your field.
@options = split (/\,/, $db_select_fields{'Symbol'});
foreach $option (sort @options) {
if ($count{$option}) {
$encoded = &urlencode($option);
#### In the line below, replace 'Category' with the name of your field.
print qq|
<TABLE WIDTH="20%" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#EDDCDC">
<tr> <td width="30%" align="left"><b><Font face="Verdana, Arial, Helvetica" Size="2"><a href="$db_script_link_url&Symbol=$encoded&view_records=1">$option</FONT></b></TD>
<td width="10%" align="center"><font face="Verdana, Arial, Helvetica" size="2"><b>$count{$option}</b></font></TD>
</TR>
</TABLE>
|;
}
}
}
# < -- End page text -->
&html_footer;
&html_page_bottom;
}
------------
Should I add code below that, such as:
++$total_count;
below the:
++$count{$fields[$fieldnum]};
and then add something like:
print|
There are $total_count symbols in the database.
;
}
Or, am I totally off base here? Thanks very much for your help.
Diana Rae