Skip to content

Behavior of selected operators on SetFilter together with a placeholder (%1)Β #7631

Closed
@Arthurvdv

Description

@Arthurvdv

1. Describe the bug
When using a SetFilter with one of the operators *, @ or ?, the behavior of the %1 placeholder changes.

2. To Reproduce

pageextension 50100 "Customer List" extends "Customer List"
{
    trigger OnOpenPage()
    var
        Customer: Record Customer;
    begin
        Customer.SetFilter("VAT Registration No.", '*8');
        Message('A: Found %1 customers', Customer.Count());

        Customer.SetFilter("VAT Registration No.", '*%1', '8');
        Message('B: Found %1 customers', Customer.Count());

        Customer.SetFilter("VAT Registration No.", '%1', '*8');
        Message('C: Found %1 customers', Customer.Count());
    end;
}
A: Found 4 customers
B: Found 0 customers
C: Found 4 customers

In case of A) and C) the placeholder (%1) is replaced with the value 8.
In case of B) the %1 isn't replaced, where the filter value is *%1 instead of becoming *8.

3. Expected behavior
Should all three messages return the same value? Not sure of this is a deliberate behavior or an bug.
In case the behavior is "by design", it would be great the include this in the documentation (Record.SetFilter(Any, Text [, Any,...]) Method) and maybe elaborate on why this design choice has been made.

4. Actual behavior
It seems that the behavior of a placeholder(s) is different on depending on the use of the *, @ or ? operators.
The other supported operators, <, <=, >, >=, <>, &, .., and | don't influence the behavior of placeholder(s).

5. Versions:

  • AL Language: 13.0.14.4367
  • Visual Studio Code: v1.85.1
  • Business Central: platform 23.0.15110.0 + application 23.2.14098.15134
  • List of Visual Studio Code extensions that you have installed: not applicable

Final Checklist

Please remember to do the following:

  • Search the issue repository to ensure you are reporting a new issue

  • Reproduce the issue after disabling all extensions except the AL Language extension

  • Simplify your code around the issue to better isolate the problem

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions