Filter string single quote escaping (PC0019)

When using filter strings that contain single quotes, the quotes must be properly escaped by doubling them. An unescaped single quote will cause the filter to fail or behave unexpectedly.

A code fix is available for this diagnostic.

Example

The following code has an unescaped single quote:

codeunit 50100 MyCodeunit
{
    procedure FilterByName()
    var
        Customer: Record Customer;
    begin
        Customer.SetFilter(Name, 'O''Brien'); // Correct - escaped quote
        Customer.SetFilter(Name, 'O'Brien'); // Filter string single quote escaping [PC0019]
    end;
}

To fix this, escape single quotes by doubling them:

codeunit 50100 MyCodeunit
{
    procedure FilterByName()
    var
        Customer: Record Customer;
    begin
        Customer.SetFilter(Name, 'O''Brien');
    end;
}