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

Shared Variable

Status
Not open for further replies.

klaidlaw

Programmer
May 28, 2008
140
US
I am using Crystal Reports 11 release 2

I am tryin to pass a running total from my subreport into my main report and I cannot figure out what I am doing wrong.

In the subreport the running total is in the Group Footer 2a and the shared variable is in Group footer 2b the formula looks like this:
Shared NumberVar ShippedQty;
ShippedQty := {#ShippedQty};

Then everything in the report is suppressed and placed into the details a section of my report.

The formula to call on the subreport is placed in the detail section b and it looks like this:
shared NumberVar ShippedQty := ShippedQty;
ShippedQty;

So I am not quite sure why i keeps returning 0 instead of the correct number. Any help would be apprectiated
 
You do not need to do this

shared NumberVar ShippedQty := ShippedQty;
ShippedQty;


In the main report it thinks the second shippedQty is a local var and has a value of zero.

When you want to use your shared var simply declare it in your main report formula and always use whileprintingrecords

ie

@yourformula

whileprintingrecords;
Shared NumberVar ShippedQty;

// add your formula using var as required.

Ian

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top