I have a set of data in Crystal reports that looks like below: You can see that each item, they have corresponding quantity.
ITEM NAME QTY SalesOrder
Pure Lounge 8 SO18030097
Spectrum 1 SO18030098
Cloud 2 SO18030099
However, there are no suppressed details in the report then the line-number should be equal to RecordNumber. So the following formula I got (thanks to this suggestion) is
CStr(RecordNumber, "0") & "/" & CStr(Count({rpt_PackingSlip.LabelQTY}), "0")
and has this output
Pure Lounge
1/11
SO18030097
Spectrum
1/11
SO18030098
Cloud
1/11
SO18030099
Notice that it sums all the records which are in total of 11.
But of course, my desired output is
Pure Lounge
1/8 (up to 8/8)
SO18030097
Spectrum
1/1
SO18030098
Cloud
1/2 up to 2/2
SO18030099
Is there something wrong with my formula? Is using RecordNumber formula the correct one? :(
How should I do it?
If there are no suppressed details in the report then the line-number should be equal to RecordNumber
. So the following formula will show the desired output:
CStr(RecordNumber, "0") & "/" & CStr(Count({Table.Column}), "0")
Replace {Table.Column}
with the column that's needed to count the total lines in your case.
—-
If the report is grouped, then a variable and the grouped itemcount is needed to get the desired output. Create following formula and put it in the group-header section:
WhilePrintingRecords;
NumberVar ItemCount := 0;
Create another formula and put it in detail section, this will increment the number:
WhilePrintingRecords;
NumberVar ItemCount := ItemCount + 1;
Then, to display the result, use following formula. Replace GroupedColumn
with the column which is used to group the report:
WhilePrintingRecords;
NumberVar ItemNumber;
CStr(ItemNumber, "0") & "/" & CStr(Count({rpt_PackingSlip.LabelQTY}, {rpt_PackingSlip.GroupedColumn}), "0")