Count table fields with specific value in SCR8. 
Author Message
 Count table fields with specific value in SCR8.

I'm trying to count fields that have a specific value (ie, STATUS = "1").  I
know I can use the count function (maybe), but I'n not clear on the syntax.
Can anyone help me?

Thanks,
JAMIE



Tue, 12 Nov 2002 03:00:00 GMT  
 Count table fields with specific value in SCR8.
Hi Jamie,

Instead of the Count function, try using a running total.  This is more coding
but it works better than the Count.  You would need to have at least 3 formulas
to do this properly based on your example.


WhilePrintingRecords;
NumberVar StatCount := 0;

Place this in a Group header or Report header.  Each time that section comes up
in the report, the report will reinitialize the counter back to 0 again.  This
is good if you are grouping on status.

The next formula will actually do the counting.  This formula goes into the
Detail section of the Report.

WhilePrintingRecords;
NumberVar StatCount;

If {table1.STATUS} = 1 then
   StatCount := StatCount + 1;

So if the Status field = 1 then it will add 1 to the counter.  Any other value
will be ignored.  When you place this in the Detail section, you can format it
to be hidden so you do not see it.

The last formula is the total.  You can place this in the Group Footer or Report
Footer and all it will do is display the final total of the counter.

WhilePrintingRecords;
NumberVar StatCount;

You can find more information on running totals in the Crystal Report Help.

--
Sincerely,
Brian Dong

To reply, remove nospam from the address.

Quote:

> I'm trying to count fields that have a specific value (ie, STATUS = "1").  I
> know I can use the count function (maybe), but I'n not clear on the syntax.
> Can anyone help me?

> Thanks,
> JAMIE



Tue, 12 Nov 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Newbie: Auto completing a CC field with a specific value

2. HowTo get max field value from Access table field

3. Retrieving recordset with only field containing specific values

4. How to find all queries that use a specific field in a table

5. Saving OLE object from Table field in a specific Directory

6. comparing data in specific fields from two tables ???

7. Count values from field in ADO Recordset

8. Count of records with field = <value>

9. Count field incorrect: not enough values for host variables

10. Count across fields in a table

11. Field count of a table with DAO

12. getting field count on an Access table

 

 
Powered by phpBB® Forum Software