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!

Suppress 2nd Subreport is no data returned in 1st

Status
Not open for further replies.

Garyjr123

MIS
Sep 14, 2010
139
0
0
US
I have two subreports in a main report and I want to make the 2nd subreport show up if the 1st subreport returns data.

The 1st subreport is looking for certain test codes in the selection expert and if they return data for those codes then I want the 2nd subreport to populate.

Thank you,

Gary
 
LB,

I have done what you asked and the only problem I have is if there is data in one of the subreports that subreport shows in GH1b so that that GH doesn't suppress completely. How do I suppress the subreports if the other is not showing so that the whole of GH1b is suppressed?

Gary
 
Could either one be populated and the other blank? Or is the same sub always the one that will be populated if one of them is blank?

The concept is that the sub has to share a variable to the following section for suppression of the following section, so you might have to add one of the subs twice, so it can suppress the other.

-LB
 
That is correct, either one of the subs can be populated and the other blank.

If I add them twice what would the formulas be or how would I go about doing this? It seems to me that I would run into the same problem with the second set of subs. Would I just be adding another GH below GH1b (the GH with the subs) and passing the variable from the GH where the new subs are to GH1b like before then do we just hide that section below GH1b so we don't see those subs but at least the variables are pasted?

What are the steps for this part (I am going to try doing it myself but I want your version so I know what I did wrong when I encounter it.)

thanks LB
 
You only need to add one, if you move one of the existing subs to a different section, like this:

GH_a Reset
GH_b Sub1a - Suppress all sections within the sub, but pass variable to suppress GH_c; suppress blank section, suppress blank subreport
GH_c Sub2 - conditionally suppress based on sub1a, suppress blank section, suppress blank subreport; pass variable to suppress GH_d and GH_e; underlay following sections
GH_d Sub1b - suppress blank section, suppress blank subreport; pass variable to suppress GH_e; underlay following sections
GH_e Main report fields

Not sure whether this would mess up the underlay that was intended to make the main report fields appear above the subs.

-LB
 
LB,

I added two test variables to GH1c to see what the new sub1a and sub2a in GH1b were passing to GH1c. I find that even though there is no data for one or the other sub or I suppress blank data, supress the supbreport etc. that in GH1b there is a value still showing up which in turn has my GH1c show up because GH1b is showing two variables which qualifies that section not to be suppressed. This is starting to get confusing.

What I did is added a GH1b with sub1a and sub2a.

Sub1a has shared stringvar code3

whileprintingrecords;
shared stringvar code3 := maximum({TEST.TESTCODE});

Sub2a has shared stringvar code4

whileprintingrecords;
shared stringvar code4 := maximum({TEST.TESTCODE});

I suppressed all sections in sub1a and sub2a (suppressed blank section and blank subreport)

In GH2c I conditionally suppressed Sub1 and Sub2 with
format subreport>suppress x+2

whileprintingrecords;
shared stringvar code3;
shared stringvar code4;
code3 = "" or
code4 = ""

I'm thinking that I have to add to my share_stringvar_code_reset formula (or create a new one for code 3&4) and add it to GH1a.

@shared_stringvar_code_reset:

whileprintingrecords;
shared stringvar code;
if not inrepeatedgroupheader then
code := "";

whileprintingrecords;
shared stringvar code2;
if not inrepeatedgroupheader then
code2 := "";

Add this to it?

whileprintingrecords;
shared stringvar code3;
if not inrepeatedgroupheader then
code3 := "";

whileprintingrecords;
shared stringvar code4;
if not inrepeatedgroupheader then
code4 := "";

What do you think?

Gary
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top