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

Shared Subreport Variable Not Read Correctly 1

Status
Not open for further replies.

jannoth

MIS
Oct 9, 2007
60
CA
I have a subreport, with a shared boolean variable called "Show" (simply warns that a "course" has been setup incorrectly).

The subreport is placed inside GF3 of my Main Report. Ultimately, I wish to use if for Group Selection and/or Suppression but the Main Report doesn't seem to be reading the current value of the variable in the subreport.

To prove it, I created the following simple formula (called Display) in the Main Report and displayed it in GF3 alongisde the subreport:
Shared Booleanvar Show;

The first few lines of my report follow (each is a GF3 section - most other sections are suppressed):

Subreport Main Report
======================
True False
True True
False True

Most lines thereafter are False & False respectively but if there is a difference, it always affects two rows as follows:

Subreport Main Report
=======================
True False
False True

Just in case you're wondering, here's the formula which assigns a value to Show in the subreport (in GF1):

Shared booleanvar Show;
If Minimum ({@Flag re Tutor}, {vRepActivity.ActivityCode}) >0 Then Show := Yes;

NB: {@Flag} simply assigns a value depending on the setup error so anything other than 0 is of interest.

Sorry if I've made a mess of explaining [dazed]

Can anyone please offer me any assistance with this??

Thanks in advance.

J
 
A shared variable can only be read correctly if referenced in a section below the one containing the sub, so if the sub is in GF3a, you should reference the shared variable in GF3b.

-LB
 
That's fantastic LB, the new section did the trick [bigsmile]

I don't know whether you expected the next question or not, but how does one now stop the entire GF3 from displaying based upon the value of that shared variable - which is read correctly??

That'd turn my 25 page report into a single page, so bosses would love me (ie you!!).

J

- PS why doesn't any CR book make these things clear haha?
Double thanks to you [peace]
 
Two steps: Place the main report fields you want to suppress in GF#3b and in the section expert->GF3b->suppress->x+2 enter:

Whileprintingrecords;
Shared booleanvar Show;
Show <> "Yes"

To make the sub and GF3a disappear, suppress all sections WITHIN the sub, remove the border from the sub, and format the sub (format subreport->subreport tab->check "suppress blank subreport"), and then in the section expert->GF#3a->check "suppress blank section".

-LB
 
Thanks LB, I adapted your feedback to my report sections and it's virtually perfect [2thumbsup]

J
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top