The AL developer preview is still evolving with frequent updates. Follow us on the Dynamics NAV Team Blog for the announcements.
GETRANGEMAX Method (FieldRef)
Gets the maximum value in a range for a field.
Value := FieldRef.GETRANGEMAX
Refers to the current field.
Property Value/Return Value
Type: depends on the field referred to by the FieldRef.
Contains the maximum value of the range set for the field referred to by the FieldRef.
The type of value must match the type of the field referred to by the FieldRef.
This method is like the GETRANGEMAX Method (Record) method.
The following example opens the Customer table as RecordRef variable, creates a FieldRef for the first field (No.) and stores the reference in the MyFieldRef variable. The SETFILTER Method (FieldRef) sets a filter that selects records in the range 10000 to 40000 from the No. field. The GETRANGEMAX method retrieves and stores the maximum value that was set in the filter, stores the value in the varMax variable and displays it in a message box. The varMax variable contains 40000 which is the maximum value that is set in the filter. This example requires that you create the following global variables and text constants.
|Text constant||ENU value|
|Text000||The maximum value in the filter is %1.|
CustomerRecref.OPEN(DATABASE::Customer); MyFieldRef := CustomerRecref.FIELD(1); MyFieldRef.SETFILTER('10000..40000'); varMax := MyFieldRef.GETRANGEMAX; MESSAGE(Text000, varMax);