Xbasic

CURRENT Function

Syntax

Current_Value as A = CURRENT([c expression])

Arguments

expression

The name of a field or an expression based on field contents.

Description

CURRENT() returns the value of a field or an expression based on field contents for the current record.

Returns 'current' value at beginning of print.

Discussion

CURRENT() is used in reports to filter records based on values from the active session's current record ( Current_Value ). The Expression parameter is evaluated once before the report is printed, and the result is available to filter records while the report runs. For example, if the current STATE field is "MA", the following report filter:

STATE_PROV = CURRENT(STATE_PROV)

will become:

STATE_PROV = "MA"

when the report is printed.

Example 

To print only the current invoice, use the following detail filter expression in your report:

INV_NO = CURRENT(INV_NO)

To print the current record, use the following detail filter expression:

RECNO() = CURRENT(RECNO() )

Form Filter and Order Expressions 

CURRENT() is particularly valuable when used with filter and order expressions that are based on functions. Consider a form filter based on the date. Assume that on August 30 the filter is run.

inv_date = date()

If the date changes to August 31 but the index is not updated (because the table has not changed), Alpha Anywhere will think that the index created on August 30 is still valid. The result is that the filter will still return records for August 30. The way to solve this problem is with the CURRENT() function.

inv_date = current(date() )

Limitations

Desktop applications only.

See Also