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!

Need help on shared variables

Status
Not open for further replies.

Hm786

Programmer
Apr 5, 2001
88
US
Hi,

I have a main report and a sub report. I am doing all the calculations in the sub report to get my gltot. The formula goes like this:

Whileprintingrecords;
shared numbervar gltot;

if {@CurrGl} = true then

gltot := {@GL Balance};


I need to use the gltot field to get my grand gl balance by adding the gltot + sum(debit)+sum(credit)on my main report. I am not able to get gltot value in my main report, it returns 0.00 even though I just call the shared numbervar gltot in my formula field. Please help me how to proceed further. My sub report is in the group footer section of the main report.


Thanks,
Hamida
 
Hey Hamida,

I'm going to go ahead and guess that the subreport is placed in the same report section as the variable which is trying to call the gltot variable in the main report.

If this is what you've got, this is why the shared variable value is coming back as 0. The formula calling gltot in the main report must be in the next report section after the subreport at the earliest.

You can achieve this by inserting a new section underneath your subreport, so that you have two group footers for the same group, and insert the shared variable formula in the latter group footer.

Good luck with your report,

Naith
 
Naith,

Thanks for your help. I inserted the sub report in the page header and created the variable after that and it worked fine.

Thanks,
Hamdia
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top