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!

Shared – Variable Mainreport to Subreport

Status
Not open for further replies.

Bennie47250

Programmer
Nov 8, 2001
515
US
Using Crystal Reports version 7.0

In my main report I have a shared variable named “CurrentYearUnitGlobalVariable” and the formula is:

shared numbervar CurrentYearUnits;
CurrentYearUnits:=Sum ({@CurrentYearYTDUnitSales}, {Customer.CTYP1})

In my Subreport I’m attempting to use the variable and the subreport is acting as if it does not know the value of the shared variable.

The formula I’m attempting to use the variable is

Sum ({@CurrentYearQtyShipped}, {Product_Family.CrystalSortOrder}) % shared numbervar CurrentYearUnits


On the main report the variable is showing in GF1
The subreport is also in GF1
The formula on the subreport is also in GF1

I have another report with practically the same formulas and it is working so I’m confident this will work if I get all the pieces in the right places.

Thanks
Bennie
 
Never mind things are working now. Must have been looking at the subreport only in the preview mode. Viewed the main report with the subreport in Preview mode and the numbers are correct.
 
The subreport containing the formula in which you reference the shared variable to do the calculation should be in GF1b if the formula establishing the shared variable is in GF1a of the main report--in other words, the variable should be referenced in the subreport placed in a section below the one in which it is established.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top