Skip to content

Previous - Built-in Database Function

Purpose

Returns the column value of the previous database row.

Syntax

Previous(column [, records])

Arguments

Argument Required Description
column Yes Column name where the value should be retrieved from
records No The amount of previous rows where the value should be retrieved from

Returns

The type of column value (integer, date, string, etc.)

See also

IsDummyZeroDate, Next, SQL, Sum

Example

If ({&Record Number} > 1) then
    Return Previous({Customer.Name})
Else
    Return ""
End
Dim counter
Dim State

Let records = 1
Let State = ""

While (IsEmpty(Previous({Customer.State}, records)) = false)
Do
    Let State = Previous({Customer.State}, records)
    Let records = records + 1
End

Return State

Notes

  • When the previous record is before the first record in the set, empty is returned. This can be validated with the IsEmpty function.
  • The number of iterations of a while do end loop is limited to 1000.