The AL developer preview is still evolving with frequent updates. Follow us on the Dynamics NAV Team Blog for the announcements.
TYPE Method (FieldRef)
Gets the data type of the field that is currently selected.
Type := FieldRef.TYPE
Refers to the current field.
Property Value/Return Value
Type: The data type of the field.
The following example opens the Customer table as a RecordRef variable that is named CustomerRecref. The code loops through fields 1 to 5 and creates a FieldRef that is named MyFieldRef for each field that is selected.
MyFieldRef.TYPE retrieves the data of each field and displays it in a message box. This example requires that you create the following global variables and text constants.
|Text constant||ENU value|
|Text000||Field %1 is a %2 data type.|
CustomerRecref.OPEN(DATABASE::Customer); FOR i := 1 TO 5 DO BEGIN MyFieldRef := CustomerRecref.FIELD(i); MESSAGE(Text000, i, MyFieldRef.TYPE); END;