cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Creating count from queried fields

Former Member
0 Likes
1,056

Post Author: John

CA Forum: Formula

Hello all. Newbie here to the forum and CR.

Running CR 9

I have a report that extracts certain data from the database. A field that displays "test code", is not part of the original search criteria. I have been asked to total "test code" but, I don't know how to count the records from the extracted data.

For example, I'm pulling in everyone with a last name that begins with a "J" and who came in the store from 01/01/07 - 01/31/07. I then list the data and also print their address, city, state, zip, and "test code". The "test code" is one of 3 possible codes. I want to have 1 running total for each of these 3.

My knowledge allows me to create a running total on the field but, the total is from ALL of the records that match.

So, if we had 45 people with "J" and 01/01/07 - 01/31/07, the running total will be 67 because it is finding all data sets that match it's code. It isn't pulling from the original search criteria of "J" and 01/01/07 - 01/31/07.

Any help is appreciated.

John

View Entire Topic
Former Member
0 Likes

Post Author: John

CA Forum: Formula

OK.. I fount the help topic on that and I created a formula that looks like this...

WhilePrintingRecords;NumberVar FFPCount;

If {PRODUCT_INVENTORY.PRODUCT_ID} = "FFP" Then FFPCount := FFPCount + 1

But, here is the problem, it is not counting only the records I display, it is counting ever time {PRODUCT_INVENTORY.PRODUCT_ID} = "FFP" in the database.

The second instance of the code = FFP says it is a count of 7.

Thanks for getting me closer!

*EDIT: As a side note, I noticed that the count was incrementing by 6 or 4. Mostly 6. This leads me to believe it is counting all the lines in the detail section because I moved the running total to GF2 and it was incrementing by 1.