OldVal Function | |
-- todo --
Returns original field values for fields that have been modified but not updated.
Namespace:
XSharp.VFP
Assembly:
XSharp.VFP (in XSharp.VFP.dll) Version: 2.21
Syntax FUNCTION OldVal(
cExpression,
uArea
) AS USUAL CLIPPER
[ClipperCallingConventionAttribute(new string[] { ... })]
public static Usual OldVal(
Usual cExpression = default,
Usual uArea = default
)
Request Example
View SourceParameters
- cExpression (Optional)
- Type: Usual
Specifies an expression whose original value OldVal( ) 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 of the table or cursor from which the original field values are returned.
Or
Specifies the work area of the table or cursor from which the original field values are returned.
Return Value
Type:
Usual
Character, Currency, Date, DateTime, Double, Float, Integer, Logical, Numeric, or Memo
Remarks OldVal( ) returns original field values for records in a X# table or cursor that has
row or table buffering enabled with CursorSetProp( ).
If a table in a database or a cursor has validation rules, OldVal( ) does not require that row or table buffering be enabled in
order to return original field values.
If the record pointer is moved to a different record when row buffering is enabled, or if TableUpdate( ) is issued to \
commit changes to the record, or there is some other action that causes an update, such as ending a transaction,
the fields are updated and the original field values are no longer available.
The data type of the value OldVal( ) returns is determined by the expression you specify with cExpression.
OldVal( ) can return .NULL., even for a field declared as NOT NULL and with Set NULL OFF.
The original field values are returned for the table or cursor open in the currently selected work area if OldVal( ) is issued
without the optional uArea arguments.
Examples 1Close Databases
2Clear
3* Create new table and add blank record
4Create Table employee (cLastName C(10))
5Append Blank
6* Insert initial value
7Insert Into employee (cLastName) VALUES ("Smith")
8* Enable and set table buffering
9Set MultiLocks ON
10=CursorSetProp("Buffering", 5, "employee" )
11* Display initial value
12=MessageBox("Original cLastName value: "+ cLastName, 0, "Results")
13* Change record value and display results
14Replace cLastName WITH "Jones"
15=MessageBox("Modified cLastName value: "+ cLastName, 0, "Results")
16* Store the old value of the field to cTemp variable and display results
17cTemp=OldVal("cLastName", "employee")
18=MessageBox("Original cLastName value: "+ cTemp, 0, "Results")
19* Update table and display final value
20=TableUpdate(.T.)
21=MessageBox("Final cLastName value: "+ cLastName, 0, "Results")
22* Close and delete example table file
23Use
24Delete FILE employee.dbf
See Also