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!

How To Tell In Main Report Which SubReport is on that page??? 1

Status
Not open for further replies.

ChubbyArse

Programmer
May 20, 2003
13
GB
Hi All,

I have a report which is one main report with several subreports, each in a separate detail section with a page break after it.

In the Main Report, I have a header which obviously spans the entire report. In that header I want to display some text dependent on which sub report is currently filling the detail on that page.

Can I do this using a shared variable????
Apologies in advance, as I'm very new to formulae.

Alex
 
Create the following formulas. This example is for three subreports, where sub1 is in detail_a, sub2 is in detail_b, and sub3 is in detail_c:

//{@sub1F} to be placed in the report header and in detail_b:
whileprintingrecords;
booleanvar flagsub1 := false;

//{@sub1T} to be placed in detail_a:
whileprintingrecords;
booleanvar flagsub1 := true;

//{@sub2F} to be placed in the report header and in detail_c:
whileprintingrecords;
booleanvar flagsub2 := false;

//{@sub2T} to be placed in detail_b:
whileprintingrecords;
booleanvar flagsub2 := true;

//{@sub3F} to be placed in the report header and in the group footer (if there is one) or in the report footer:
whileprintingrecords;
booleanvar flagsub3 := false;

//{@sub3T} to be placed in detail_c:
whileprintingrecords;
booleanvar flagsub3 := true;

You can suppress each of the above formulas. Then create a formula to be placed in the page header:

whileprintingrecords;
booleanvar flagsub1;
booleanvar flagsub2;
booleanvar flagsub3;

if flagsub1 then "Subreport 1" else
if flagsub2 then "Subreport 2" else
if flagsub3 then "Subreport 3" else ""

-LB
 
That did it, LB - a very neat solution.

I can't help but think if Crystal were to implement an object / event model, you wouldn't be having to drop formulae all over the place!!!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top