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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sum of SharedVar 1

Status
Not open for further replies.

brizaybrizoke

Technical User
Jul 21, 2011
25
US
Crystal 8.5

MainReport
RH = Cross-Tab
PHa = Cross-Tab Subreport 1
PHb = Subreport 2
D = Suppressed
RF = Suppressed
PF = RH Cross-Tab SharedVar formula AND Sum of All SharedVar

I have a sum of three sharedvar in the page footer of my main report that was working as expected until one of the sharedvar reached 0, or rather, " " (nothing).

How can I modify my formulas or sum to evaluate " " (nothing) as 0 and count it as such?

Any and/or all of the three sharedvar can and/or will reach " "/0 eventually for this report.

//PF RH Cross-Tab SharedVar
whileprintingrecords;
Shared NumberVar AutoBatchTotal := sum({Ordzones.ORDZONES_TOT_LINES})

//PHa Cross-Tab Subreport 1 SharedVar
whileprintingrecords;
Shared NumberVar ToteBatchTotal := sum({Ordzones.ORDZONES_TOT_LINES})

//PHb Subreport 2 SharedVar
whileprintingrecords;
Shared NumberVar BatchlorTotal := Sum({Relord.RELORD_ORD_QTY})

//PF Sum of All SharedVar
whileprintingrecords;
Shared NumberVar BatchlorTotal;
Shared NumberVar ToteBatchTotal;
BatchlorTotal + ToteBatchTotal + sum({Ordzones.ORDZONES_TOT_LINES})

Please let me know if more information is needed

Thanks in advance!
 
Change them to something like


//PF RH Cross-Tab SharedVar

whileprintingrecords;
Shared NumberVar AutoBatchTotal;

If isnull(sum({Ordzones.ORDZONES_TOT_LINES})) then
AutoBatchTotal :=0 else
AutoBatchTotal := sum({Ordzones.ORDZONES_TOT_LINES});

Ian
 
Thanks Ian!

I have yet to see the values drop to 0 since I made the changes. Hopefully this evening I'll know whether or not I formulated correctly.
 
And I'm back.

The report breaks in two different ways depending on the value of 'SharedNumber Var AutoBatchTotal' and the formula for @OpenPicks.

//PF @MyTotal and @OpenPicks

//@MyTotal
WhilePrintingRecords;
Shared NumberVar AutoBatchTotal;

if isnull(sum({Ordzones.ORDZONES_TOT_LINES})) then
AutoBatchTotal := 0 else
AutoBatchTotal := sum({Ordzones.ORDZONES_TOT_LINES});

//@OpenPicks
whileprintingrecords;
Shared NumberVar BatchlorTotal;
Shared NumberVar ToteBatchTotal;

BatchlorTotal + ToteBatchTotal + sum({Ordzones.ORDZONES_TOT_LINES});

When I use the two formulas above and AutoBatchTotal is null, the value for @OpenPicks disappears.

I then found when AutoBatchTotal is null and I change the formula for @OpenPicks to to the following, the value reappears.

//@OpenPicks
whileprintingrecords;
Shared NumberVar BatchlorTotal;
Shared NumberVar ToteBatchTotal;
Shared NumberVar AutoBatchTotal;

BatchlorTotal + ToteBatchTotal + AutoBatchTotal;

Where am I going wrong with my formulas?

Thanks again in advance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top