Mastering Business Analysis with Crystal Reports 9 (Wordware Applications Library)

The structure of a function begins with the function name. The function name is then followed by an opening parenthesis, the arguments for the function (separated by commas), and a closing parenthesis. Figure C-1 displays an example of a function structure:

Figure C-1: The structure of a function

Note

In Figure C-1, the curly brackets surrounding the Orders.Order Date field designate a database field. Refer to the following table for a summary of reserved characters and the types of arguments they represent. This information was presented in Chapter10.

Table C-1: Reserved characters of the Crystal Reports and Basic languages

Reserved Character

Name

Description

{ }

Curly brackets

Used to contain the report objects (such as the database or formula fields). For example: {Employee.First Name}

[ ]

Square brackets

Used to create computational formulas. Another common use for them is to return the character of a string field. For example, {Employee.First Name}[1] returns the first character of this string field.

( )

Parentheses

Used with operators to contain the different parts of a formula and define the order the calculations should take place.

.

Period

Separates the table name from the database field. For example: {Employee.Last Name}

""

Quotation marks

Used to surround text that you wish to display within your formulas. For example, "USA" would display the text USA within your report.

,

Comma

Used to separate multiple parameters within a formula.

@

Formula

Designates formula fields. For example: {@Name_of_Formula}

?

Parameter

Designates parameter fields. For example: {?Name_of_Parameter)

#

Running total

Designates running total field. For example: {#Name of Running Total}

Summary

Designates a summary field. For example: {∑Name_of_Summary_Field}

%

SQL expression

Designates an SQL Expression field. For example: {%Name_of_SQL_Expression}

The following sections summarize the different functions available within Crystal Reports.

Категории