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

How do I declare a variable in Crystal? 1

Status
Not open for further replies.

Frostburn

Programmer
Jul 10, 2001
8
US
This formula keeps causing Crystal Reports to crash:

if Sum ({@YearlyBudget}, {tblSubSection.SSName}) > 0 then

Sum ({@AvailableBudget}, {tblSubSection.SSName}) / Sum ({@YearlyBudget}, {tblSubSection.SSName}) * 100

--How do I declare variables to work with so the formula can deal with those, not the actual sumations?

Thanks
 
Dont you want to affect that formula to a field or something ? : Sum ({@AvailableBudget}, {tblSubSection.SSName}) / Sum ({@YearlyBudget}, {tblSubSection.SSName}) * 100

Wouldnt it be : FIELD = Sum ({@AvailableBudget}, {tblSubSection.SSName}) / Sum ({@YearlyBudget}, {tblSubSection.SSName}) * 100

That if if u want it to be displayed in a field. If you want variables, just look in the C.R. help.. but i belive it's :

booleanVar x := y;
currencyVar x := y;
dateVar x := y;
stringVar x := y;

Hope it will give u a hint !
 
Also check out this link(it can be found in FAQ for formulas)

Goto insert/formula, once you are formula editor select "Operators", then "Variable Declarations". Also check out Scope to determine how lifespan of the variable.

You can find functions to convert datatypes in formula editor under "Functions" then "Strings".

Make sure you are not mixing datatypes, Crystal report does not give descriptive error messages for debugging.
 
Forgot to include sample of declaration

Shared CurrencyVar Var1;
Shared CurrencyVar Var2;

Var1:= {@YearlyBudget};
Var2:= {@AvailableBudget};




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top