### Previous (fld)

Crystal syntax.

PreviousValue (fld) and Previous are equivalent functions. However, you can use Previous only with Crystal syntax, and PreviousValue only with Basic syntax.

##### Arguments

fld is any valid database or formula field in the report.

##### Returns

A field value of the same type that was passed as the fld argument.

##### Action

Previous (fld) returns the value of the specified field in the previous record.

##### Typical uses

You can use previous to identify the last record in a previous range or the last record occurring before a new range begins, or to test for duplicate values.

##### Examples

The following examples are applicable to Crystal syntax:

If Previous({file.QTY}) <> 0 Then
{file.QTY}/2
Else
{file.QTY}

Tests the previous value in the {file.QTY} field to see if it is a zero value. If it is not, it divides the value by two. If it is a zero value, it returns the value itself.

If Previous ({customer.CUSTOMER ID}) = {customer.CUSTOMER ID} Then
"Repeated Value"
Else
""

This flags repeated values in the {customer.CUSTOMER ID} field.

If Remainder(Previous ({file.SERIALNUM}), 300) = 0 Then
"Beginning, new block"
Else
""

Divides the previous value in the {file.SERIALNUM} field by 300. If there is no remainder, it flags the current value as "Beginning, new block". If there is a remainder (Else) it prints no flag. (This formula divides serial numbers into blocks of 300.)

Note: Using this function in a formula forces the formula to be evaluated at print time. For more information on evaluation time considerations, see Evaluation Time functions.

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