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

Shared Variables

Status
Not open for further replies.

PBS2

Programmer
May 17, 2004
43
GB
I have a report which is structured as follows:-

Details a SUBREPORT1
Details b SUBREPORT2
Details c SUBREPORT3

Group Footer#1 Branch @Total1 @Total2 @Total3
branch


Where the formula @Total1 on Subreport1 is:-
whileprintingrecords;
shared currencyvar total1 = SUM({Sales},{Branch})

Where the formula @Total2 on Subreport2 is:-
whileprintingrecords;
shared currencyvar total2 = SUM({Sales},{Branch})

Where the formula @Total3 on Subreport3 is:-
whileprintingrecords;
shared currencyvar total3 = SUM({Sales},{Branch})

My problem is that I want the report to initially display only the totals by branch (in the Group Footer). Then when the user drills down on these totals to display the full detail in the Subreports.

I find that if I hide or surpress Detail a,b and c then the formulas in the Group Footer evaluate as zero. I guess this is because the formulas use "WhilePrinting" ? If I don't suppress the detail the formulas evaluate correctly but I don't get the drill down functionality I require.

Anyone got any bright ideas??


 
The reason you have 0 totals on your hands is because suppressing the section in the main report that contains the subreport effectually turns the subreport off. So it doesn't process.

True, you don't need WhilePrintingRecords when passing variables between sub and main reports but taking it out in this case won't achieve anything, and it's actually best practice to use take control of the evaluation time of your variables where possible using WhilePrintingRecords or any of the other processing time enforcers.

What are you actually trying to achieve here? Is it absolutely necessary to have 3 subreports in your detail section, because this must be making your report must run like an absolute dog. Can you show us some sample data, and what the subreports are there for?

If they do need to be there, but don't want to see the subreport data, try suppressing all the sections within the subreports, rather than suppressing the main report details section.

Naith
 
Yes I think I need the subreports as the table I am using contains 3 different date fields. Each subreport uses a different date field to extract the data.

If I suppress the Subreport sections, then how do I make them reappear when I drill down when they need to appear?
 
PBS,

I'm still not convinced that subreports is the right way forward here, especially since it seems like all your reports are hitting the same table. If you were to illustrate what you're doing with an actual data sample, I'm pretty sure you could achieve what you're after with variables, and still get your drill down action going on.

You're only going to successfully drilldown if you enable hide, rather than suppress (which I guess is what you meant you were doing before). You aren't going to be able to do this unless you click on the actual subreport, unless you use a report part hyperlink to get you access to the subreport, and being as you haven't supplied your CR version, I don't know if you have this option.

(On a side note, in order for the shared variables to inherit the sum value, you want to be using ":=" to assign the value to the variable rather than "=".)

If you can, provide a data sample, and I'm positive you can get what you need going down a simpler route.

Naith
 
Yes I am using := rather than = in my shared formulas.

If I make my Subreports into Hyperlinks then I'm afraid the formulas still evaluate as zeros (I am using CR v.10).

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top