Returns field values directly from disk for a table or a remote data source.
CURVAL(cExpression [, cTableAlias | nWorkArea])
- Specifies an expression whose value CURVAL(В ) returns from a table or a remote data source. cExpression is typically a field or an expression consisting of a set of fields from the table or remote data source.
- Specifies the alias of the table from which the field values are returned from disk for a table or a remote data source.
- Specifies the work area of the table from which the field values are returned from disk for a table or a remote data source.
Character, Currency, Date, DateTime, Double, Float, Logical, Numeric, or Memo
The field values returned by CURVAL(В ) and OLDVAL(В ) can be compared to determine if another user on a network changed the field values while the fields were being edited. CURVAL(В ) and OLDVAL(В ) can only return different values when optimistic row or table buffering is enabled. Optimistic row or table buffering is enabled with CURSORSETPROP(В ).
|If you are working with a view in a multiuser environment, the values returned by CURVAL() might not be up to date unless you call the REFRESH() function first. Data returned by a view is buffered, and the CURVAL() function reads values from the buffer. However, if other users have changed data in the underlying tables for the view, the buffered data is not updated until the REFRESH() function is called.|
CURVAL(В ) returns field values for the current record, and the return value data type is determined by the expression you specify with cExpression.
The value is returned for the table or cursor open in the currently selected work area if CURVAL(В ) is issued without the optional cTableAlias or nWorkArea arguments.
This example creates a free table named
mytable, and a value of "One" is inserted into the
cDigit field. Optimistic table buffering is enabled with SET MULTILOCKS ON and CURSORSETPROP(В ).
A value of "Two" is then inserted into the
cDigit field, and CURVAL(В ) and OLDVAL(В ) are used to display the original
cDigit values. TABLEUPDATE(В ) is used to commit the changes to the table, and CURVAL(В ) and OLDVAL(В ) are used to display the new
cDigit values. Note that because this is a single user example, CURVAL(В ) and OLDVAL(В ) return the identical values.
CLOSE DATABASES CLEAR CREATE TABLE mytable FREE (cDigit C(10)) * Store original value INSERT INTO mytable (cDigit) VALUES ("One") SET MULTILOCKS ON && Allow optimistic table buffering = CURSORSETPROP("Buffering",5) && Optimistic table buffering on REPLACE cDigit WITH "Two" && New value ? "Current value: " + CURVAL("cDigit", "mytable") ? "Old value: " + OLDVAL("cDigit", "mytable") = TABLEUPDATE(.T.) && Commit changes made to table ? "Table changes committed" ? "New current value: " + CURVAL("cDigit", "mytable") ? "New old value: " + OLDVAL("cDigit", "mytable")