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  


Type: FieldRef

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.

Variable name DataType
CustomerRecref RecordRef
MyFieldRef FieldRef
varType Variant
Text constant ENU value
Text000 Field %1 is a %2 data type.

FOR i := 1 TO 5 DO BEGIN  
  MyFieldRef := CustomerRecref.FIELD(i);  
  MESSAGE(Text000, i, MyFieldRef.TYPE);  

See Also

FieldRef Data Type