Crystal Reports for Rational Application Developer Designer Guide

Variable declarations (Crystal syntax)

Before using a variable in a formula, you must declare it.
A variable can hold values of a given type. The allowed types are the seven simple types (Number, Currency, String, Boolean, Date, Time and DateTime), the six range types (Number Range, Currency Range, String Range, Date Range, Time Range and DateTime Range) and variables that hold arrays of the previously mentioned types. This gives a total of 26 different types that a variable can have.
When you declare a variable, you also specify its name. A variable cannot have the same name as any function, operator or other keyword that is valid for Crystal syntax. For example, your variable cannot be named Sin, Mod or If because Sin is a built in function, Mod is a built in operator and If is a built in keyword. When typing formulas on the Formulas page, the names of the built in functions, operators and other keywords are highlighted in a different color and so it is easy to check if the variable name conflicts.
Once a variable is declared, it can be used in the formula. For example, you might want to assign it an initial value:
Local NumberVar x; //Declare x to be a Number variable
x := 10; //Assign the value of 10 to x

Note: The keyword for declaring the Number variable has a Var at the end. This is true for all the variable types in Crystal syntax.
A variable can only hold values of one type. For example, if a variable holds a Number value, you cannot later use it to hold a String.



Business Objects, an SAP company
http://www.businessobjects.com/
Support services
http://www.businessobjects.com/services/support/
Product Documentation on the Web
http://support.businessobjects.com/documentation/