cancel
Showing results for 
Search instead for 
Did you mean: 

Counting within a PO

janet_donbavand
Explorer
0 Kudos
113

I have a report grouped by PO. Within the group there are various order lines each with a Status - C for Complete, P or W if not yet Complete. However I just want to see whether the whole PO is complete - if any of the order lines within it are P or W, I want it to say "Incomplete" at the Summary Group level, and then work out how many POs are completely complete, and how many still have some outstanding lines.

View Entire Topic
DellSC
Active Contributor

This is possible but it's going to take a couple of formulas. Something like this:

{@IncompleteForCount}
if {MyTable.status field} = 'P' or {MyTable.status field} = 'W' then 1 else 0


{@CompleteForCount}
if {MyTable.statusField} = 'C' then 1 else 0

{@IsComplete}
if sum({@IncompleteForCount}, {MyTable.PO Field}) > 0 then 'Incomplete' else 'Complete'

{@CompleteForTotal}
WhilePrintingRecords;
NumberVar completeCount;
if OnFirstRecord then completeCount := 0;
if {@IsComplete} = 'Complete' then
  completeCount := completeCount + 1;
""

{@IncompleteForTotal}
WhilePrintingRecords;
NumberVar incompleteCount;
if OnFirstRecord then incompleteCount := 0;
if {@IsComplete} = 'Incomplete' then 
  incompleteCount = incompleteCount + 1;

{@ShowCompleteTotal}
WhilePrintingRecords;
NumberVar completeCount

{@ShowIncompleteTotal}
WhilePrintingRecords;
NumberVar incompleteCount

You'll use {@IsComplete} to get the Complete vs. Incomplete labels in either the PO group header or footer. You don't need to put the formulas above that anywhere - the Sum() will make them run automatically .

Put both {@CompleteForTotal} and {@IncompleteForTotal} in the PO group footer - neither will actually display anything but they need to be there for the calculation to happen.

Put the two "Show" formulas in the report footer to get the total counts.

-Dell

janet_donbavand
Explorer
0 Kudos

Many thanks; I'll give it a go and let you know how I get on.