I have a report with one subreport. The subreport is calculating a value and I would like to enter that calculated value into a formula in the main report. Is there a way to insert the subreport's produced value?
Data can be passed between main and sub reports using shared variables.
In your case create a formula in your sub report that sets a shared variable to the value you want to pass to the main report:
// {MySharedVariable}
WhilePrintingRecords;
Shared StringVar MyShrVar;
MyShrVar:= (calculation or database field)
In the main report create a formula that declares the same shared variable, but do not assign a value. Place the formula in the main report in a section below the section containing the subreport:
// {MySharedVariable}
WhilePrintingRecords;
Shared StringVar MyShrVar;
Also, be sure to create a formula in the report header of the subreport that resets the shared variable back to zero or blank or null:
// {MySharedVariableReset}
WhilePrintingRecords;
Shared StringVar MyShrVar:= ""
The formula declaring the shared variable in the main report will contain the value set in the subreport and is available for display, calculations, etc.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.