Skip to Content
avatar image
Former Member

How to do a simple count

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jul 19, 2017 at 11:08 PM

    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.

    NumberVar myCount := 0; 

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

    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,


    Add comment
    10|10000 characters needed characters exceeded