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

passing parameter from subreport to main report 1

Status
Not open for further replies.

varakal

IS-IT--Management
Mar 18, 2004
114
US
Hi.. I have a problem passing value from subreport to main report.

I have following code in a formula in a subreport, where I am using
shared variable. I should get #Total Billable Amount value into
total_asr_value. (#Total Billable Amount value is correct and I am
getting it).

if Isnull({#Total Billable Amount}) then
shared numberVar total_asr_value := 0
else
shared numberVar total_asr_value := CDbl({#Total Billable Amount})

In the main report, I defined in a formula as below:

shared numberVar total_asr_value


But I am not getting the value here.
Help is greatly appreciated. Thank you.

 
You should state where the subreport is and where you're trying to use the shared variable in the main report.

Also inculding a whileprintingrecords at the beginning of your formula is a good idea (though it is the default).

Try placing the subreport in the report header, and your formula in the report footer, you should see the value being apssed.

If you're trying to display the subreport value in the same section as the subreport, right click the section that the subreport is in and select insert section below, and place the formula in the new section.

-k
 
The subreport is embedded within the main report. It is designed to gather some information and build a table of information passed back to the main report using Shared variables.

The subreport uses a stored procedure to perform the query because I need to be able to query from either a main database or a history database, and the tables in each database are in the exact same format.
 
TO synapsevampire

SubReport is in the report footer. I am getting the formula value as 0 instead of getting the value of #Total Billable Amount which should be 300. I created one more section but the result didnt changed.
When I tried to display the value of #Total Billable Amount in the subreport, it is showing correct value 300.

I couldnt understand where might be the error is.
Thanks.
 
Try this:

Place the subreport in the report header

Place the formula which pulls the shared variable into the report footer.

Does it return the right value?

Try these formulas:

subreport formula with the subreport in the main report header:
whileprintingrecords;
shared numberVar total_asr_value;
if Isnull({#Total Billable Amount}) then
total_asr_value := 0
else
total_asr_value := CDbl({#Total Billable Amount})

main report formula in the report footer ot the main report:
whileprintingrecords;
shared numberVar total_asr_value;

Do NOT suppress nor hide the section that the subreport is in.

This is a fairly common thing, so it's likely some little thing that's getting you...

-k
 
I could know that subreport should be in the former section than the section where I use this shared variable.
But then, it didnt worked out.
The thing is,
The subreport formula where I declared shared variable should be placed in one of the sections in subreport.
i.e, subreport formula should be placed in some subreport section, well you can hide it if you dont need it.
That caused the major problem.
I dont know the exact reason: whether the fomula will be executed only when placed in some section in the report or if it something else.
Thanks a lot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top