Skip to Content
0

How to do a simple count

Jul 19, 2017 at 09:52 PM

27

avatar image

I have a Crystal Report that is summary data. I need to add to the report a sequential number for each row.

I usually do a running count on a unique detail col but now I don't have this.

I tried doing shared variable then adding 1 to it but it's only adding the one time.

Can you guide me as to how this can be done?

it would need to reset when the group changes.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Brian Dong Jul 19, 2017 at 11:08 PM
0

Hi Paul,

Are your rows in the Detail section or a group footer or header?

I believe the reason your running total is resetting is because you are not initializing it in the proper place. If the numbering runs through the entire report and doesn't need to be reset then initialize your counter in the Report Header.

WhilePrintingRecords; 
NumberVar myCount := 0; 

In the section your rows appear just do a simple running total like:

WhilePrintingRecords; 
NumberVar myCount :=  myCount + 1; 

That should do it for you. You could even get away without using the first formula but I do to make sure the variable doesn't introduce a NULL or something.

Good luck,

Brian

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Also, have a look at just dropping on the RecordNumber field or GroupNumber field if its in a group. Should do the same unless your hiding rows.

0