Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

8.02 Case Sensitivity, Writing Comments, Line Terminators

Formula Fundamentals

This section on fundamentals of writing formulas covers Case Sensitivity, Writing Comments, Returning a Value, Using Data Fields, Declaring Variables, Simple Data Types, Array Data Types, and Range Data Types. Each topic has its own section.

Case Sensitivity

Basic syntax is not case sensitive. The variable FirstName is the same as the variable firstname. Although these two variables are syntactically equivalent, it is recommended that you keep the case consistent so that your program is easier to read. If you always capitalize the first letter of a word in a variable; you should do so for all variables.

Writing Comments

Comments are designated by using a single apostrophe. You can also use the familiar REM keyword

‘This is a comment
REM This is also a comment

Crystal syntax uses // within a line to comment out the remaining characters.

//This is a comment

Line Terminators

Basic syntax assumes that each programming statement only takes a single line of text. The carriage return (hidden) marks the end of the line. If a statement needs more than one line, the line continuation character _ is used.

X = 5 ‘This is a single line
Y = "This takes " _
& "two lines"

Crystal syntax uses the semicolon to mark the end of a line. A programming statement can use multiple lines with no special characters. If there are multiple statements within a formula then use the semicolon to separate the lines. If a formula only has one line of code, no semicolon is needed (but you can put it there if you wish).

X := 5; \\ This is a single line
Y := "This is also "
& "a single line";