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

how to def a var, then access it in other formulas

Status
Not open for further replies.

diamondtektips

Programmer
Nov 18, 2003
6
CA
i put the following in group header 2:
global currencyvar margin_total_var:=0

i am trying to create the following to put into group footer 2:
WhilePrintingRecords;

if {vr_08611.Past03} > 0 then
if a>b then
margin_total_var+=0
else
margin_total_var+=1
else
margin_total_var+=0

However I hit upon this error message everytime I check the code "A number,currency amount, ..blah blah.. is expected here" and it puts the cursor at the first occurence of margin_total_var... Anybody know why this occurs and how to fix it?

Good karma to all who help...
 
ok, nevermind guys. i figured it out. crystal syntax is somewhat vb, and somewhat not vb... it's a mind bender to first define a shared var, then to refer to it you use the entire definition rather than just to call it by it's name...

i.e.
...in report header
whileprintingrecords;
shared currencyvar total:=0;

...in details of report
whileprintingrecords;
// use whatever formula you like
shared currencyvar total:=total + {table.field};

...in footer
whileprintingrecords;
shared currencyvar total;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top