Цитата:
Сообщение от
iolanna
Объясните фильтрацию, CALCFIELDS, SETFILTER и др.
Когда и как их применять!
Когда подходит один, когда другой!
CALCFIELDS - это не фильтрация. Это расчет поля с типом Flowfield.
SETFILTER и SETRANGE используются для фильтрации.
SETRANGE(Field,от значения [, до значения])
SETFILTER(Field,'сложный фильтр',значение1, значение2, ....) -
Кстати по F1 очень подробно описано
SETRANGE (Record)
Use this function to set a simple filter, such as a single range or a single value, on a field.
Record.SETRANGE(Field [,FromValue] [.ToValue])
Record
Data type: record
The record that contains the field you want to filter.
Field
Data type: field
The field you want to filter.
FromValue
Data type: -
The lower limit of the range. The type of FromValue must match Field.
ToValue
Data type: -
The upper limit of the range. If you omit this parameter, the system uses the value you specified for FromValue. The type of ToValue must match Field.
Comments
SETRANGE provides a quick way to set a simple filter on a field. If you call this function with a field that already has a filter, the system removes that filter before it sets the new one. If you omit all of the optional parameters, the system removes any and all filters set for Field.
The fieldref function fails if no field is selected.
Example
This example shows how to use the SETRANGE function to specify that you only want to see customers 100 through 200.
Customer.SETRANGE("No.", '100', '200');
The above statement is a quick way to set the same filter as:
Customer.SETFILTER("No.", '>=100&<=200');
SETFILTER (Record)
Use this function to assign a filter to a field you specify.
Record.SETFILTER(Field, String, [Value],...)
Record
Data type: record
The record that contains the field you want to filter.
Field
Data type: field
The field you want to filter.
String
Data type: text or code
The filter expression. A valid expression consists of alphanumeric characters and one or more of the following operators: <, >, *, &, |, and =. You can use replacement fields (%1, %2, and so on) to insert values at run-time.
Value
Data type: any
Replacement values to insert in replacement fields in the filter expression. The data type of Value must match the type of Field.
Comments
If the function is called with a field for which a filter already exists, the system will remove that filter before it sets the new one. You can construct filters using these operators:
This operator...
Means...
..
Range
&
And
|
Or
<
Less than
<=
Less than or equal to
>
Greater than
>=
Greater than or equal to
<>
Different from
*
Forms a part of value
Example
This table shows examples of filters:
This example...
Means...
A..Z
A range from A to Z
A | G
A or G
F.. & *A/S
A range from F and A/S is included in the field.
<>B
All except B
<>''
All not blank
<=200 | >500
All less than or equal to 200 or greater than 500
Using a filter with replacement field:
This filter selects all accounts in the range from 100 to 200 and No. 300
"G/L Account".SETFILTER("No.", '%1..%2|%3', '100', '200', '300');
Using a filter entered directly in a string:
This filter, which is entered as a string, corresponds to the previous example. It too selects all accounts in the range from 100 to 200 and No. 300.
"G/L Account".SETFILTER("No.", '100..200|300');