Choosing a Formula Language: Crystal Versus Basic Syntax

Choosing a Formula Language Crystal Versus Basic Syntax

In previous chapters, the Crystal syntax was used for all formulas. However, formulas in Crystal Reports can be created, edited, and modified using one of two languages. The Crystal syntax is the most used language, but the Basic syntax is also available.

Both languages are equal in their functionalitymeaning that if something was added to Crystal syntax, it was also added to Basic. The reason you're given a choice is for your comfortyou can use whichever language you are more comfortable with using.

Understanding Syntax Differences

The Crystal syntax is most similar to the Pascal or Delphi programming languages. It's not exactly like Pascal, but if you're a Delphi developer or a longtime Crystal Report developer, this syntax is probably your first choice.

The Basic syntax is most similar to Visual Basic as a programming language. If you're a Visual Basic developer, you'll likely find this syntax most beneficial.

Some specific differences between the two languages are described in Table 13.1.

Table 13.1. Differences Between Crystal and Basic Syntax




Variable declarations



Statement endings


None required

Comment characters



Variable assignment



Formula statement

None required


Formula returns

None required

Return statement

Multiline statement indicators

None required


If statement ending


End If


Why Basic Syntax Was Added

Many functions and operators provided by the Basic language increase the productivity of Crystal Reports users. By implementing the whole language, the existing Crystal syntax users could benefit from the new operators and functions and at the same time, newer users who are familiar with the Basic language through other development endeavors could easily make the jump to creating formulas in Crystal Reports.

Some of the functions and operators that were added as a result of the addition of the Basic syntax are

  • Date functions such as DateAdd, DateDiff, and DateSerial
  • Financial functions such as Present Value (PV)
  • Control structures such as Do While, Do Until, and For Next statements

Selecting the Best Syntax for You

Whether you choose Basic or Crystal syntax, they are both equally capable of doing the job and there is no performance implication in making this choice. The decision is entirely based on the comfort level and familiarity of each language for report designers.


Whichever syntax you prefer to use most often, you can set it up as the default for all new formulas by going to File, Options, Reporting, and choosing the desired syntax in the Formula Language list box.

Special Edition Using Crystal Reports 10
Special Edition Using Crystal Reports 10
ISBN: 0789731134
EAN: 2147483647
Year: 2003
Pages: 341
Simiral book on Amazon © 2008-2017.
If you may any questions please contact us: