cancel
Showing results for 
Search instead for 
Did you mean: 

Passing a variable from subreport to main report

Former Member
0 Kudos
1,274

Hello,

Was hoping to get some assistance on this issue I'm facing.  I've got a sub-report that calculates a monthly goal based off the date selection criteria. And I'd like to pass this goal back to the main report.

In my sub-report, I created a new formula named ProcGoalVariable:

WhilePrintingRecords;

Shared Numbervar ProcedureGoal := cdbl({#ProcGoal})

While {#ProcGoal} is a running total I created for the sub-report and now I'd like to pass it back to the main report.

In the main report, I created a new formula named ProcGoalVariable:

Shared NumberVar ProcedureGoal;

ProcedureGoal;

But when I drop this into my report, it is returning a value of 0.  In the screen shot, the Proc. Needed should actually equal the Proc Goal:

Any suggestions on how to pass this correctly?

View Entire Topic
Former Member
0 Kudos

Thanks for the advice,

I want to rewind a bit to make sure I am explaining myself clearly.  My sub-report is pulling the correct numbers and it is located in GF#3 and contains two values that fall under "Proc Goal" and "Prod Goal". These are being calculated correctly and I would then like to pass them back to the main report for additional calculations done on this.

In the sub-report, a formula was created "ProcGoalVariable":

WhilePrintingRecords;

Shared Numbervar ProcedureGoal := cdbl({#ProcGoal})

In the main report, a formula was created "ProcGoalVariable"

Shared NumberVar ProcedureGoal;

ProcedureGoal:=ProcedureGoal;

Would having the same name inside the formulas being causing the issue? And I've tried inserting a new section below the section where my subreport lives and I still get a value of 0.

Not sure what else to try at this point.

abhilash_kumar
Active Contributor
0 Kudos

Have you tried changing the formula on the Main Report to:

whileprintingrecords;

shared numbervar ProcedureGoal;

-Abhilash

Former Member
0 Kudos

I just tried and it did not resolve the issue.

Thanks,

abhilash_kumar
Active Contributor
0 Kudos

Would you be able to share the report with saved data please?

-Abhilash

Former Member
0 Kudos

Sure, and I appreciate your time and assistance.

https://drive.google.com/file/d/0B8ErGi0v2xIJUVdJNjZvaVRUMXM/edit?usp=sharing

Thanks,

sylvainchevalle
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Trey,

OK I see your problem. In your subreport simply insert your @ProcGoalVariable in the FOOTER in an hidded part of the subreport like this:

That should make the final result of your variable available for the main report but then you have to manipulate it always after the Group footer 3a anyway.

Regards,

Sylvain

Former Member
0 Kudos

Thank you kindly, that worked.