GETRANGEMIN Function (Record)
Gets the minimum value in a range for a field.
Value := Record.GETRANGEMIN(Field)
Parameters
- Record
Type: Record The record that contains the field.
- Field
Type: Field The field for which you want to find the minimum value. The current filter on Field must be a single range filter; otherwise, a run-time error occurs.
Property Value/Return Value
Type: Depends on Field
Contains the minimum value of the range set for Field. The type of the return value must match the type of Field.
Example
In this example, you have a filter that defines a single range.
This example requires that you create the following variables and text constant in the C/AL Globals window.
Variable name | DataType | Subtype | Length |
---|---|---|---|
CustomerRec |
Record |
Customer |
Not applicable |
Val |
Code |
Not applicable |
10 |
Text constant | ENU value |
---|---|
Text000 |
The minimum value is: %1. |
CustomerRec.SETFILTER("No.",'100..200');
Val := CustomerRec.GETRANGEMIN("No.");
MESSAGE(Text000, Val);
The following message is displayed:
The minimum value is: 100.
In this example, you have a filter that is a single value.
This example requires that you create the following variables and text constant in the C/AL Globals window.
Variable name | DataType | Subtype | Length |
---|---|---|---|
CustomerRec |
Record |
Customer |
Not applicable |
Val |
Code |
Not applicable |
10 |
Text constant | ENU value |
---|---|
Text000 |
The minimum value is: %1. |
CustomerRec.SETFILTER("No.",'100');
Val := CustomerRec.GETRANGEMIN("No.");
MESSAGE(Text000, Val);
The following message is displayed:
The minimum value is: 100.
In this example, you have a filter which is not a single range.
This example requires that you create the following variables and text constant in the C/AL Globals window.
Variable name | DataType | Subtype | Length |
---|---|---|---|
CustomerRec |
Record |
Customer |
Not applicable |
Val |
Code |
Not applicable |
10 |
Text constant | ENU value |
---|---|
Text000 |
The minimum value is: %1. |
CustomerRec.SETFILTER("No.",'200|300');
Val := CustomerRec.GETRANGEMIN("No.");
MESSAGE(Text000, Val);
This example causes a run-time error to occur.