{{sidenavigation.sidenavigationExpandLabel}}
{{getMsg('Help_YouAreHere')}}: {{page.title}} {{page.title}}
{{$root.getMsg("downLoadHelpAsPdf")}} {{helpModel.downloadHelpPdfDataStatus}}

Syntax - Feature Comparison (Basic Syntax vs. Crystal Syntax)

Writing formulas can either be done in Crystal or in Basic syntax.

Basic Syntax

The syntax rules of the basic syntax are very similar to those of Microsoft's Visual Basic and other forms of Basic.

Crystal Syntax

The syntax rules of the crystal syntax are similar to the formula syntax of Crystal Reports.

Feature Basic Syntax Crystal Syntax
Case-sensitive? No No
Variable declaration dim a as number
dim b as string
numbervar a;
stringvar b;
Variable assignment a = 10 a := 10;
Variable scope Local: dim a or local a Shared: shared a Global: global a Local: local numbervar a; Shared: shared numbervar a; Global: global numbervar a; or
numbervar a; (Default)
Comparison operators 10 < pi()*3
10 = a
Rem a = 10 would be assignment
10 < pi() * 3;
a = 10; or 10 = a | | End of statement(s) | Line Break or Colon | Semi-colon | | Result of formula | Assign return value to variable formula | Result of last line | | Comment | ' comment
Rem comment |
comment
If then else statement global a as number if a = 10 then a = 20 formula = "a was 10" elseif a = 20 then a = 30 formula = "a was 20" else a = 0 formula = "a was not 10 or 20" end if numbervar a; if a = 10 then ( a := 20; "a was 10"; ) else if a = 20 then ( a := 30; "a was 20"; ) else ( a := 0; "a was not 10 or 20"; );
"For" loop formula = "" dim i for i = 1 to 10 step 2 formula = formula + "ab" next i ' Returns: "ababababab" stringvar result := ""; numbervar i; for i := 1 to 10 step 2 Do ( result := result + "ab"; ); result; Returns: "ababababab" | | "While" loop | formula = "" dim i as number i = 1 do while i <= 10 i = i + 2 formula = formula + "ab" loop
' Returns: "ababababab" | stringvar result := ""; numbervar i := 0; while i <= 10 Do ( i := i + 2;
result := result + "ab"; ); result;
Returns: "ababababab"
principles Basic accepts only statements that "do something". Therefore a single number is not a statement. It may be an expression within an if-condition. But in case you assign that number to a variable it becomes a correct statement because it does an assignment. In Crystal Syntax everything has a return value - at least "null". As a result everything is a statement and the last evaluated statement delivers the returned value.
i-net Clear Reports
This application uses cookies to allow login. By continuing to use this application, you agree to the use of cookies.


Help - Basic Syntax / Crystal Syntax