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
 
The subs should be in separate sections, e.g., sub1 in GH_b and sub2 in GH_c. In GH_a, add a formula like this (you can suppress the section):

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

In sub1, create a formula like the following and place it in the subreport footer:

whileprintingrecords;
shared stringvar code := maximum({table.code});

In the section expert of the main report, select GH_c->suppress->x+2 and enter:

whileprintingrecords;
shared stringvar code;
code = ""

-LB
 
LB,

Thanks for the info but I want to alter this a bit. What if I want to suppress the whole group header if there is no data for subreport 1 or if subreport 1 has data but no data for subreport 2.

It would look like this:

GHa [encounter.encounter_id] Pat name PID encounter_id
GHb Subreport 1 Subreport 2
D [suppressed}

if subreport 1 returns no data then suppress GHa
if subreport 1 has data but subreport 2 does not then suppress the GHa
if subreport 1 does not have data and subreport 2 does have data then suppress GHa
if subreport 1 has no data and subreport 2 has no data then suppress GHa

Make sense?

Thanks,

Gary
 
You are thus saying both subs must have data.

-LB
 
To suppress the group header, the subs would have to be in the GHa section, with the gh fields in gh_b. So the question is what exactly are you displaying in the subs if they do populate--are there multiple columns in each or is it just one value from each sub?

-LB
 
The subreports could show multiple values for that patient, so:

GHa Harry, Smith 555555 444444 11/13/2011
GHb Subreport 1 Subreport 2
Trop 1.1 AFB 3.1
Glut 14.1 Trop 4.1
AFB 31 CBC 14

The end user wants to compare test analytes from one site to another so both subreports are limited to certain analytes but usually do return multiple results.
 
GH_a should be suppressed, but will be where you place the reset formula as in my first post. Add a separately named variable for the second sub, e.g., shared stringvar code2.

The subs MUST be above the GH, but you could potentially put them in GH_b and format GH_b to underlay following sections, and leave white space above the subs so that GH_c data (where you would put the main report GH data appears to be above the sub info in the display. Then you would create shared variables within each sub using the earlier formulas (again, change the sub code variable to code2).

Then in the main report, suppress GH_c with:

whileprintingrecords;
shared stringvar code;
shared stringvar code2;
code = "" and
code2 = ""

Each sub should formatted to "suppress blank subreport" and the GH_b section should be formatted to "suppress blank section".

-LB
 
LB,

What is does the reset formula for GHa look like? I don't see it in your previous posts.

Thank you,

Gary
 
LB,

I think we need to walk through this one more time b/c the report is not removing the results with patients that don't have both subreports showing data.

In both subreports I put the following formulas in the RF:

Subreport 1 RF
{@shared_stringvar_code}

whileprintingrecords;
shared stringvar code := maximum({ANALYT.CODE});

Subreport 2 RF
{@shared_stringvar_code2}

whileprintingrecords;
shared stringvar code2 := maximum({ANALYT.CODE});

In the Main Report:
GH1a Formula:

{@shared_stringvar_code_reset}

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

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

GH1b Subreport 1 & 2 (underlay)

GH1c Main report fields
Selection Expert > Suppress > x+2

whileprintingrecords;
shared stringvar code;
shared stringvar code2;
code = "" and
code2 = ""

What did I do wrong?

Thanks,

Gary
 
The set up looks correct (as long as you mean you used the section expert to suppress GH1c), so I'm wondering whether you suppressed or hid the GH1b section or suppressed the subreports. Doing either of these will prevent the shared variables from passing.

Please test the values of the shared variables in GH1c by creating formulas for each in the field explorer like this:

whileprintingrecords;
shared stringvar code;

Please report back with the results when you place the formulas in GH1c.

-LB
 
LB,

The subreports are filtered by {test.testcode}

Subreport 1
Select Expert > Test.Testcode > is one of FSGLU, IS6P, ISCR, ISCTPANEL, ISORCG8P, ISTROP

Subreport 2
Select Expert > Test.Testcode > is one of BMP, CMP, CREAT, GLU, TROP

Does this make a difference?

Basically, it is passing the shared stringvar code (& code2), I see the maxium({test.testcode}) showing up in the main report GH1c (& not showing up when there is no data).

Gary
 
Ok,

I changed this:

GH1c Main report fields
Selection Expert > Suppress > x+2

whileprintingrecords;
shared stringvar code;
shared stringvar code2;
code = "" AND
code2 = ""

to

whileprintingrecords;
shared stringvar code;
shared stringvar code2;
code = "" OR
code2 = ""

Changing the AND to an OR is now suppressing the GH1c which is a good sign but I want the whole returned row (or patient data and subreports) to not show up. Not just the main report patient data.

Thanks,

Gary
 
That is not the way to go--you said you wanted GH1c suppressed only if BOTH subs didn't have data, so you need to use AND. if the shared variables are appearing with correct values in GH1c, then the section suppression formula should work on GH1c.

To suppress details, use the same code again:

whileprintingrecords;
shared stringvar code;
shared stringvar code2;
code = "" AND
code2 = ""

To make the subs disappear, you have to go to format subreport->subreport tab->check "suppress blank subreport" and also format GH1b to "suppress blank section". If there are parts of a sub that appear even when there is no code data, then you would have to conditionally suppress those using something like:

isnull(maximum({table.code}))

-LB
 
LB,

Sorry to have mislead you but I wnat to suppress GH1c (actually all the data) if either of the subreports do not show data so the "OR" does work for me.

Ultimately, is there anything we need to do differently to suppress the patients returned data (GH1a, b, c) if there is one subreport with data?

Thanks,

Gary
 
No, just change the suppression formula to the "or".

-LB
 
LB,

When I add the shared stringvar to any other section in the suppression x+2 of the select expert no data is returned for the entire report.

(the following formula in GH1, GH1a or b

whileprintingrecords;
shared stringvar code;
shared stringvar code2;
code = "" OR
code2 = ""

Gary
 
That makes no sense to me. Are you sure you didn't add in colons, e.g., ":=" in the suppression formula (which would reset the values to "")?

-LB
 
Nope, I used the formula you gave me and implemented it in GH1c which worked fine. It suppressed the main report data when the variable returned "" but when I added the same formula to the x+2 in any other GH (i.e. a or b) the report just comes back blank. So, this doesn't make any sense to me either as to why it wouldn't work for other GH's.

Again, all I want the report to do is not show me the patient data with at least one of the subreports that doesn't return data.
 
No, the formula cannot work in GH_a or GH_b, since those sections are before the shared variables get any values. GH_a should just be suppressed as a section. GH_b should be formatted to "suppress blank section" and as I said before, the subs should be formatted to "suppress blank subreport". When you take those two steps for GH_b, does anything show when the sub has no values? If so, what shows?

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top