Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with summing whileprintingrecords

Status
Not open for further replies.

Tonyvee73

Technical User
Jul 4, 2018
10
GB
Hi
Quite new to crystal and need to get a sum in an existing report but need some help?

Have this in GH2
WhilePrintingRecords;
numbervar RunPhysical;
RunPhysical:= {STK_STOCK.STK_PHYSICAL} + {STK_STOCK.STK_QTYPRINTED}

Have this in Details
Whileprintingrecords;
Numbervar RunPhysical;
If {STK_MOVEMENTS.SM_DATE} > {?Report Date} And {STK_MOVEMENTS.SM_STATUS} = 'I'
Then
(if {STK_MOVEMENTS.SM_SERIALTRACK}=1 then
RunPhysical := RunPhysical - 1
else
RunPhysical := RunPhysical - ({STK_MOVEMENTS.SM_QUANTITY}*{STK_MOVEMENTS.SM_QTYUNIT})
)
Else
If {STK_MOVEMENTS.SM_DATE} > {?Report Date} And {STK_MOVEMENTS.SM_STATUS} = 'O'
Then
(if {STK_MOVEMENTS.SM_SERIALTRACK}=1 then
RunPhysical := RunPhysical + 1
else
RunPhysical := RunPhysical + ({STK_MOVEMENTS.SM_QUANTITY}*{STK_MOVEMENTS.SM_QTYUNIT})
)
Else
RunPhysical := RunPhysical




Have this in GF2
whileprintingrecords;
numbervar RunPhysical;


I have totals being generated in the GF2 but need the sum of these in GH1 - is there a way to do this?
Really sorry if anyone needs more info, as I say, im new to CR
Many thanks
 
You can not put WhileprintingRecords var totals in Group Headers.

If you want them to appear in GH you must add a Subreport and then pass a Shared Var to the Group Header. You can make Subreport very thin and you can hide all fields in SR so that it does not impact report layout. But you can not hide in a suppressed section, you can make it very thin and then get the section holding the SR to underlay and this reduces impact even further.

Ian
 
Ok and thanks for the reply, however not quite sure how to start here - any pointers?
 
Can you explain why you are using variables? What fields are you grouping on? What happens if you remove the variables and just use a conditional formula and then insert summaries on it at various group levels?

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top