Sets a simple filter, such as a single range or a single value,
on a field.
|
Record.SETRANGE(Field [,FromValue] [,ToValue])
|
Parameters
- Record
-
Type: Record
The record that contains the field that you want to filter.
- Field
-
Type: Field
The field that you want to filter.
- FromValue
-
Type: Any
The lower limit of the range. The data type of this parameter
must match the data type of Field.
- ToValue
-
Type: Any
The upper limit of the range. If you omit this parameter, the
value that you specified for FromValue is used. The data type of this
parameter must match the data type of Field.
Remarks
Example
This example shows how to use the SETRANGE function to
specify that you want to see only customers 100 through 200. This
example requires that you create the following variable in the C/AL
Globals window.
Variable name |
DataType |
Subtype |
CustomerRec
|
Record
|
Customer
|
|
Copy Code |
CustomerRec.SETRANGE("No.", '100', '200');
// The above statement is a quick way to set the same filter as:
CustomerRec.SETFILTER("No.", '>=100&<=200');
|
This example shows how to find the first record that
has a blank for the requested delivery date. It requires that you
create the following variable.
Name |
Data type |
Subtype |
SalesLineRec
|
Record
|
Sales Line
|
|
Copy Code |
SalesLineRec.SETRANGE("Requested Delivery Date",0D);
IF SalesLineRec.FIND('-') THEN
MESSAGE('Sales Order %1 has no requested delivery date.', SalesLineRec."Document No.");
|
See Also