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

Shared/ Global Variable not working

Status
Not open for further replies.

AdamField

Technical User
Apr 16, 2009
25
BE
Hey all,

I have this report i'm working on that is acting strange

i have a shared variable counter:
formula 1:
shared numbervar counter := 0 (header)
formula 2:
shared numbervar counter;
IF test1 THEN counter := counter +sum(fieldX) ELSE cunter := counter + sum(fieldY) (group lvl)
formula 3:
shared numbervar counter (footer)

now what it's suposed to do:
first i declair the variable
second in detail section i count the number of times a sum from a detail field is higher as >1 and i count that amount to my counter
then on the bottom of the report i show the total

now the problem:

when i use shared numbervar on a 1 page report it works great and i get a nice total on the bottom.
now with shared number var still but on a 3 page report he restarts my formula 2 on every page so for example page 1 i get 58 page 2 58 and page 3 20
the formula 3 show's me 20

when i change all the varaible's to global the counter keeps running and on the end of page 3 i get with formula 2 a nice 136 but with formula 3 i get 0

any idees ?

Tnx for the advice



 
Which header? If you put the reset in the page header then it would do just that. Try moving it to the report header.

You could also do the whole task using a running total. The use of Crystal's automated totals is outlined at FAQ767-6524.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Tnx for the link and the fix Madawc,
My declaration formula was indeed in the page header in stead of the report header.

Greetings
Adam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top