Skip to Content

In Crystal, how to count per line item not per qty in an order?

May 07 at 09:45 PM


avatar image

In Sap Crystal, I am looking for a better option to have the formula to count the # of items per line. (not per workorder)

Example, I have one Work Order# with 2 different items called Eton and Davina.

If I want to print the report, I would like to see that it is counting the # per product not as an order.

My code is:

WhilePrintingRecords; NumberVar ItemCount := ItemCount + 1; `ToText(ItemCount, "0") & "/" & ToText(Count({rpt_PackingSlip.LabelQTY}, {rpt_PackingSlip.WorkOrderNo}),0,"")

Crystal Report Design:

Current Output: Int the below output, it is counting as 1/2 and 2/2, but my desired output should be 1/1 (for Eton) and 1/1 (Davina) because it should be counting per product NOT counting how many items in 1 work order.

capture.jpg (146.1 kB)
3.jpg (157.8 kB)
capture1.jpg (36.9 kB)
capture3.jpg (33.2 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Ian Waterman May 08 at 07:54 AM


I am sure you have asked this before, add another group based on Product underneath Work order.

Change your formula so that this bit

ToText(Count({rpt_PackingSlip.LabelQTY}, {rpt_PackingSlip.WorkOrderNo}),0,"")

replace this field {rpt_PackingSlip.WorkOrderNo} with your Product Group Field


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

Hi Ian,

I'm getting an error "There must be group that matches this field"

What I did is, I created a new formula and put it underneath Work Order.

But then I run it, and put the formula:

design.jpg (118.7 kB)
group.jpg (65.2 kB)
Ian Waterman May 09 at 07:13 AM

You have to create another Group 3 using field Packingslip.itemNo, suppress header and footer as you have done with Groups 1&2


10 |10000 characters needed characters left characters exceeded