Sets or gets the value of the field that is currently selected.
This function returns an error if no field is selected.
[CurrValue :=] FieldRef.VALUE([NewValue])
- Type: FieldRef or TestPage Field Refers to the current field.
- Type: Variant The new value that you want to set for the field.
Property Value/Return Value
The current value of the field.
If you omit NewValue, the function returns the current value of the field.
If you want to format the value of a FieldRef you must use
FORMAT(FieldRef) instead of
The following example opens table 18, the Customer table, a RecordRef variable that is named CustomerRecref. The FIELD Function (RecordRef) creates a FieldRef for the first field (No.). The reference to the field is stored in the MyFieldRef variable. The ACTIVE Function (FieldRef) function determines whether the field is enabled. If the field is enabled, then the record that is identified by the number in the CustomerNo variable is selected. The MyFieldRef variable is updated to refer to the second field (Name). Then the value in the second field is changed to Contoso. The MODIFY Function (RecordRef) modifies the record in the table to reflect the change.
MyFieldRef.VALUE retrieves the new name and displays it in message box. This example requires that you create the following variables and text constant in the C/AL Globals windows.
|Text constant name||ConstValue|
Customer name has changed to %1.
CustomerNo := '50000'; CustomerRecref.OPEN(18); MyFieldRef := CustomerRecref.FIELD(1); IF MyFieldRef.ACTIVE THEN BEGIN MyFieldRef.VALUE(CustomerNo); MyFieldRef := CustomerRecref.FIELD(2); MyFieldRef.VALUE('Contoso'); CustomerRecref.MODIFY; MESSAGE(Text000, MyFieldRef.VALUE); END