Skip to content
Arthur edited this page Feb 20, 2024 · 7 revisions

SetFilter with unsupported operator in filter expression.

This rule aims to validate filter expressions for operators: *, @, and ? together with any placeholder (%1, %2, etc).
Including these operators directly in the filter expression may lead to unexpected behavior, as the placeholders aren't replaced.

Supported operators

A valid expression consists of alphanumeric characters and one or more of the following operators: <, <=, >, >=, <>, &, .., *, | and @

Record.SetFilter(Any, Text [, Any,...]) Method

Bad code

Customer.SetFilter("VAT Registration No.", '*%1*', MyValue);
Customer.SetFilter("VAT Registration No.", '@*%1*', MyValue);
Customer.SetFilter("VAT Registration No.", '??%1*', MyValue);

Good code

Customer.SetFilter("VAT Registration No.", StrSubstNo('*%1*', MyValue));
Customer.SetFilter("VAT Registration No.", StrSubstNo('@*%1*', MyValue));
Customer.SetFilter("VAT Registration No.", StrSubstNo('??%1*', MyValue));

External references

Clone this wiki locally