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

Problems with shared variables

Status
Not open for further replies.

SmithyJD

IS-IT--Management
Sep 23, 2004
52
GB
Hi all and thanks for any help but I am still having problems using a shared variable. the background is I have a report showing stock information and need to include on it total demand from the workshop (held line by line in a second file)

I created my main report and a sub report which totaled the workshop demand and tried to use a shared varaible to pass this back to the main to calculate free stock. the definition in the main report is

formula field mainformula defined as
whileprintingrecords;
shared numbervar mytotal;
mytotal


in the sub report i have subformula defined as
whileprintingrecords;
shared numbervar myTotal:= sum({@Needed})


all works well so long as there is a demand and records exist in the sub report if not the previous total is returned. I understand I need to reset the variable to zero but how do I do that I can only have one definition of the field cant I? People have mentioned having

mytotal:=0

at a level above the subreport but isnt the definition of a formular the same regardless of level or am I being a real plonker?

Thanks in hope

 
Wuzza plonker? Wait, I don't wanna know...

In a section Prior to the subreport create a formula containing:

whileprintingrecords;
shared numbervar mytotal:=0;

Then you can reference the formula created by the subreport in the main report only in a section AFTER the subreport.

Where you place it is dependent upon where in the main report the subreport is, which you didn't share.

-k
 
Thank you a 1000 times thats it fixed it just going to study it and work out whats happening but thats taken me and my business forward big time a real big thanks.

Plonker is a term made famous in the uk in a comedy series called "only fools and horses" a must see for anyone really

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top