GETRANGEMAX Function (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 function is like the GETRANGEMAX Function (Record) function.
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 Function (FieldRef) sets a filter that selects records in the range 10000 to 40000 from the No. field. The GETRANGEMAX function 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 variables and text constant in the C/AL Globals windows.
|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);