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

Suppress subreport conditionally 1

Status
Not open for further replies.

xsw1971

Programmer
Jun 21, 2001
153
US
I have a subreport that is returning rows of data as well as a shared variable. The subreport is displayed in the Details section of my grouped main report(so there is a subreport for every group.)

If the returned shared variable is a certain value, I want to suppress the entire details section for that group. Is there a way to evaluate the shared variable and THEN display/suppress the subreport based on the shared variable?

Thank you,
Jennie
 
A subreport in the details will fire for every row in the group, not just once per group.

Generally a subreport is at a group level.

As for suppressing the subreport based on the value it returns, the subreport has already fired, so the group that it is contained within has already fired as well.

Consider suppressing within the subreport.

-k
 
Thanks k,

Thanks for the tip - that works for me.

I have question (I'm not familiar with subreports and shared variables.) Now that I have brought the value of my shared variable to my main report from the subreport, how do I create summaries for it? I have 3 levels of grouping and want a running total for each. I tried using the Running Total Wizard, but it doesn't let me use the formula that creates the shared variable.

Thank you,
Jennie
 
Right, you'll need to use a formula to perform aggregates against it.

So if your subreport is at the detail level, create 3 formulas:

GH formula:
whileprintingrecords;
global numbervar MySum :=0;

Details formula:
Details formula
whileprintingrecords;
shared numbervar SharedVar;
global numbervar MySum := MySum+SharedVar;

GF Formula for display:
whileprintingrecords;
global numbervar MySum;
MySum

This demonstrates resetting it at the group level, place the fields wherever you need to reset and display.

-k
 
Once again, thanks k! That was a big help. It seems simple once someone else does it and I can see how it applies, but it doesn't seem very intuitive (I don't think I would have ever though to do it that way!).

Jennie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top