cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

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

Ian

Former Member
0 Kudos

Trish

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

Ian

Former Member
0 Kudos

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: