Progress
Report Builder
User’s Guide


PREVIOUS

Returns the value of the specified field in the previous record. This function is useful for suppressing repeating data in fields other than group fields and for performing calculations with fields in different composite records.

SYNTAX

PREVIOUS ( field-name ) 

field-name

The name of any field in the report.

Records that do not satisfy the filter currently in use are not accessible with this function. Also, PREVIOUS returns UNKNOWN in the first record.

EXAMPLE

If the Orders table contains fields for customer number (Cust-num), order number (Order-num), and order date (Order-date), you can use the PREVIOUS function to calculate the number of days since any customer’s previous order, assuming that orders are sorted by date within customer. The expression for a Days-since field might be:

IIF(PREVIOUS(Cust-num) = Cust-num, Order-date - PREVIOUS(Order-date), 0) 

Translated, this expression means that if the customer number is the same as the customer number in the previous composite record (in other words, if Report Builder is reading a record for a second or subsequent order by the same customer), it returns a value that is the current order date minus the order date in the previous composite record. Otherwise, it returns 0.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095