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

Display only records that have a match record in subreport 1

Status
Not open for further replies.

mouser4069

Technical User
Feb 28, 2007
11
0
0
US
I am working on a report in CR9 where I have written a formula to pass a variable from a subreport to my main report. This is working and the information is displaying correctly.

I now need to write a formula? to limit my records returning in the main report to those that have $$ associated (this is the shared variable). I have tried several times, but am not getting this correct.

Any suggestions?
 
You need a reset formula in the main report in a section before the subreport executes, e.g., GH_a:

whileprintingrecords;
shared currencyvar x := 0;

Then you should be able to go to the section expert->group header/detail/groupfooter sections->suppress->x+2 and enter:

whileprintingrecords;
shared currencyvar x;
x = 0 //note no colon

-LB
 
I do have reset formulas in place in the correct location. However, when I apply your fomula, I suppress the subreport figures. I need to supress the main report information also.

I actually have two subreports, amountsaved1 and amountsaved 2. If both of these subreports come back with $0.00, then I need to supress all of the information in the section.

I really appreciate any assistance!
 
In Crytal 9, you can suppress a blank section, even if it displays a subreport. right-click on the field and choose Format Field. Check [Suppress Blank Section].

This won't work if you also have mainframe fields in the section with the subreport. It evaluates them before processing the subreport. Values passed back by Shared Variables aren't usable until the next section down.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
My suggestion was not for suppressing the subreport. I meant in the main report to go to the section expert and use the conditional suppression formula.

Please explain your group structure and where your subreport is located. Then explain what you want suppressed. If you are requiring that both subreports return a 0 then you should change your section suppression formula to:

whileprintingrecords;
shared numbervar x1;
shared numbervar x2;
x1 = 0 and
x2 = 0

-LB
 
Thank you for all of your assistance. I do truly appreciate it!

I have two groups – GroupHeader 1) for a court name, and GroupHeader2) for a concatenated {filename and filenumber} group.

My reset formulas are in GroupHeader 1. My GroupHeader 2a contains the guts of the report, along with the subreports. I have placed the formulas in the main report to accept the information from the subreport in GroupHeader 2b.


In my subreports I have the following formula to pass the information to the main report:

Subreport1:
WhilePrintingRecords;
Shared CurrencyVar AmountSavedS:= {#RTotal0_SoughtAgainst} - {#RTotal0_DispAgainst}

Subreport 2:
WhilePrintingRecords;
Shared CurrencyVar AmountSavedC:= {#RTotal0_SoughtAgainst} - {#RTotal0_DispAgainst}


In my main report, I have the following formulas to accept the information from the subs:

For Subreport 1:
WhilePrintingRecords;
Shared CurrencyVar AmountSavedS

For Subreport 2:
WhilePrintingRecords;
Shared CurrencyVar AmountSavedC

My main report also has the following reset formulas:

Reset Formula1:
Whileprintingrecords;
Shared CurrencyVar AmountSavedS:=0;

Reset Formula2:
Whileprintingrecords;
Shared CurrencyVar AmountSavedC:=0;


My suppress formula has been placed in the Section Expert in GroupHeader 2a (which is the area I want suppressed conditionally):

whileprintingrecords;
shared CurrencyVar AmountSavedC;
shared CurrencyVar AmountSavedS;
AmountSavedS=0 and
AmountSavedC=0
 
The problem is that the subreport isn't evaluating until after the section you want to suppress.

Try switching your sections around by moving GH2b above GH2a this can be done in the section expert.

HTH

Gary Parker
MIS Data Analyst
Manchester, England
 
WHOOOOO HOOOOO! Success. Thank you Thank you Thank you!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top