[ic] How to dispay the total number of items in one page?

Ed LaFrance edl@newmediaems.com
Thu, 18 Jan 2001 08:59:33 -0800


At 12:02 PM 1/18/01 +0200, you wrote:
>Hello!
>I want in the first page to display "There are *** items in the store" ,
>where *** the total numbers of items in the database.....
>Is that possible?
>
>Thank you...
>
>
>
>Thomas

Thomas -

Minivend had a usertag called db-count for just that purpose.  I couldn't 
grep it in my IC installation so I guess it fell by the wayside.  Here it 
is - put it in a file in your interchange/usertag directory and restart 
IC.  Haven't tried it with interchange but I think it should work...

- Ed L.

# [db-count table]
#
# This tag returns the number of records in a database table,
# 'products' by default.
#
UserTag  db-count  Order table
UserTag  db-count  PosNumber 1
UserTag  db-count  Routine <<EOF
sub {
     my ($db) = @_;

     $db = 'products' unless $db;

     my $ref = Vend::Data::database_exists_ref($db)
         or return "Bad table $db";
     $ref = $ref->ref();
     my $count;
     while ($ref->each_record()) {
         $count++;
     }
     return $count;
}
EOF



 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
New Media E.M.S.               Software Solutions for Business
463 Main St., Suite D          edl@newmediaems.com
Placerville, CA  95667         http://www.newmediaems.com
(530) 622-9421                 (530) 622-9426 Fax
(866) 519-4680 Toll-Free
 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>