Jump to content
We've recently updated our Privacy Statement, available here ×

Calculated field from two subreports


robert.hassel

Recommended Posts

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

Pass Variables from Subreport Back to the Main Report (Shared Variables)

Crystal

When you declare your variable as SHARED you are then able to pass that variable to subreports or the main report.  To use it in the main report or subreport you simply need to redeclare it and the value will be available.

SHARED NumberVar shStuCount;

shStuCount := DistinctCount({D_STU.STU_UNQ_ID}, {D_STU.LEA_ID});

Jasper

This ability is accomplished by using the “Edit Return Values” on the subreport.  This allows for the main and subreport to talk to each other through the use of the specified variable.

 

  1. Click the add, edit, delete button to manage the shared variables
  2. Add the subreport variable that you want to pass to the main report
  3. Add the main report variable that you want to pass the variable to

Add a calculation type that you would like the shared variable to have.  If you are just passing a value back and for the then “No Calculation Function” should be used.  In the example above the vSubRPTVariable/vMainRPTVariable is acting as running total between the main and subreport.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...