Click or drag to resize

CurVal Function

X#
-- todo --
Returns field values directly from disk for a table or a remote data source.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.21
Syntax
 FUNCTION CurVal(
	cExpression,
	uArea
) AS USUAL CLIPPER
Request Example View Source

Parameters

cExpression (Optional)
Type: Usual
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.
uArea (Optional)
Type: Usual
Specifies the alias or workarea number of the table from which the field values are returned from disk for a table or a remote data source.

Return Value

Type: Usual
Character, Currency, Date, DateTime, Double, Float, Logical, Numeric, or Memo
Remarks
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 uArea arguments.
Examples
X#
 1Close Databases
 2Clear
 3Create Table mytable FREE (cDigit C(10))
 4* Store original value
 5Insert Into mytable (cDigit) VALUES ("One")
 6Set MultiLocks ON        // Allow optimistic table buffering
 7= CursorSetProp("Buffering",5)   // Optimistic table buffering on
 8Replace cDigit WITH "Two"    // New value
 9? "Current value: " + CurVal("cDigit", "mytable")
10? "Old value: " + OldVal("cDigit", "mytable")
11= TableUpdate(.T.)       // Commit changes made to table
12? "Table changes committed"
13? "New current value: " + CurVal("cDigit", "mytable")
14? "New old value: " + OldVal("cDigit", "mytable")
See Also