## Crystal syntax fundamentals

### The result of a formula

The result of a formula, or the value that is printed when the formula is placed in a report, is called the value returned by the formula. Every formula in Seagate Crystal Reports must return a value. For example, here is a simple Crystal syntax formula that returns a value of 10:

`10`

The value returned by a formula can be one of the seven simple data types supported. These are Number, Currency, String, Boolean, Date, Time, and DateTime.

Note: Seagate Crystal Reports also supports range types and array types, but these cannot be returned by a formula.

For example, suppose a company has a shipping policy in which orders over $1,000 are insured, but orders below that amount are not insured:

    //A formula that returns a String value
    If {Orders.Order Amount} >= 1000 Then
       "Insured shipping"
    Else
       "Regular shipping"

The formula returns the text string value "Insured shipping" if the value of the database field {Orders.Order Amount} is greater than or equal to 1000; otherwise, it returns the text string value "Regular Shipping" otherwise.

Seagate Software, Inc. http://www.seagatesoftware.com Please send comments to: techpubs@seagatesoftware.com