Gossamer Forum
Home : Products : DBMan : Customization :

Records.cgi

Quote Reply
Records.cgi
Is it possible to count the different records ?

I would put a variable with :

- total records
- total categories

in records.cgi.

Possible ?


------------------
--- Luc
Quote Reply
Re: Records.cgi In reply to
Unfortunately...at this time...the Mod only works with one field...I will see what I can do about enhancing the Mod to count additional fields...but no promises.

Wink

Regards,

------------------
Eliot Lee
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. :)
----------------------











Quote Reply
Re: Records.cgi In reply to
Sorry for my English, but I try to explain what I mean with an example :

records.cgi give now :

rec1 (5)
rec2 (7)
rec3 (17)
rec4 (1)
rec5 (1)

At the top or bottom of this page I am looking for a variable that count

Total records : 31
Different records : 5 (rec1-rec5)

Is this possible ?

------------------
--- Luc
Quote Reply
Re: Records.cgi In reply to
Thanks for visual...again the codes would have to be tweaked...which I do not have time to do right now.

It is possible...just would take some time to re-work the script. The total records would be relatively easy to do..."the different records"...I am a bit confused about what you want, so you will have to be more specific. (Do you mean a different field being listed?)

But for the total number of records, try the following:

1) Add the following sub-routine in the records.cgi file:

Code:
sub numcat {
#------------------------------------------------------------------
# Displays number of categories

my $count = 0;
open (DB, "<$db_file_name") or
&cgierr("error in numbercat. unable to open database:$db_file_name.\nReason:
$!");
LINE: while ( ) {
if (!(/^#/) && !(/^\s*$/)) {
$line = $_;
chomp ($line);
@fields = &split_decode ($line);
$count;
}
}
close DB;
return $count;
}

2) Then add the following codes:

Code:
print qq|Total Number of Records:|; &numcat;

Hope this works and helps...

If it works (which it should), then I will add a flag variable to choose whether to have the Total Number of Records posted and then add the codes I've posted in this Thread.

Please be more specific about that different records request.

Regards,

------------------
Eliot Lee
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. Smile
----------------------













[This message has been edited by Eliot (edited February 17, 2000).]
Quote Reply
Re: Records.cgi In reply to
This is what I received after putting in the codes :

Adams: (1)
Aerostar: (4)
Aviatik: (2)
B.F. Stuttgart: (1)
Balloon Works: (1)
Barnes: (1)
Cameron: (204)
Chaize: (2)
Colt: (8)
Durondeau: (19)
GEFA-Flug: (1)
Kubicek: (22)
Libert: (9)
Lindstrand: (20)<

and then it stop counting.

There are 14 manufacturers listed from the 22 on the list.
22 is the first result of a variable I need.

The second is a total of all the numbers between the (--). Maybe this is stupid to count because this is also the total of all the records in the Database, not ? And I think this will take a lot of time to count.

If possible the first result, the total of different manufacturers.


------------------
--- Luc
Quote Reply
Re: Records.cgi In reply to
I have replied to you via private email. And for others interested...I have a bone to pick with Luc, and that is why I am sending a private email...It is not to provide technical support...I do not like answering technical questions related to Gossamer Threads scripts via private email.

That is all.

Regards,

------------------
Eliot Lee
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. Smile
----------------------













[This message has been edited by Eliot (edited February 18, 2000).]