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

suppress group based on shared variable

Status
Not open for further replies.

atarrqis

IS-IT--Management
Nov 26, 2004
155
US
Oracle and CR 11.5
I have 2 groups, #1 = Part No, #2 = Transaction ID
There are multiple lines for each transaction _id.
I have a formula that sums qty at group #2 footer based on type of transaction = {@qty}

I have a shared variable that sums @qty = Q
WhilePrintingRecrods;
NumberVar Q := Q + {@qty};

I display Q at group #1 footer.
I would like to suppress all of the data (#2 footer & #1 footer ) if Q=0
 
Are you using a subreport? If not, you don't need a Shared Variable.

Try displaying the result of your sum. You can't use it to suppress anything until it has the final value.

Depending on what you're doing, you might be able to use a Summary Total for quantity. Unlike other totals, summary totals are worked out before printing starts and can therefore be used to suppress it.

The use of Crystal's automated totals is outlined at FAQ767-6524. Worth getting to know what's possible, for future work.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 2008 with SQL and Windows XP [yinyang]
 
I can't use a Summary Total because my qty is based on a formula. You're right - it doesn't need to be a shared variable although it is in a subreport but I think it does need to be a variable in order to sum a formula. I think this requires doing a WhilePrintingRecords - but is there a way to suppress based on these results?
 
What is the content of {@qty} and of any nested formulas within it?

-LB
 
if {PROJ} = {?Pm-CONTRACT} then {QUANTITY}
else {QUANTITY}*-1

where CONTRACT is passed from the main report.
 
I'm confused--I'm not seeing where you have established a shared variable in the subreport. Is the suppression all occurring within the subreport? Or are you trying to suppress something in the main report based on the subreport value? You need to describe the groups in the main report and in the sub, and clearly identify where formulas are placed in main and sub, and in what section the sub is located.

-LB
 
Sorry. I corrected myself above - I should not have said 'shared variable' - just a variable as shown in
WhilePrintingRecrods;
NumberVar Q := Q + {@qty};

All of the suppression is occurring within the subreport.
{@qty} is in GF2b,

{sum of qty} =
WhilePrintingRecrods;
NumberVar Q := Q + {@qty};
is in GF2c,

{display sum of qty} =
WhilePrintingRecords;
NumberVar Q;
is in GF1,

{reset sum of qty} =
WhilePrintingRecords;
NumberVar Q :=0;
is in GH1.

I need to suppress all of this (GF2 & GF1)if Q=0.



 
You can do summary totals on Formula Fields, provided they don't contain any summary values or reference to Past or Next detail lines.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 2008 with SQL and Windows XP [yinyang]
 
You say that {@qty} is in group #2 footer--but note that this formula is a detail level formula, and will pick up the value of quantity only in the last record in each group #2. If you mean it to pick up all values in the detail section, then you could use a suppression on all sections using this formula:

sum({@qty},{table.partno})=0

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top