Zum Inhalt springen
SETFILTER issue with special characters in Business Central

Why SETFILTER doesn’t work sometimes

Daniel Gorski
Daniel Gorski 04. Mai 2023
1 Min. Lesezeit

Every AL-Developer uses “SETFILTER” on a daily basis. But did you know that there are certain situations where “SETFILTER” will refuse to work?

First let’s look at the syntax:

Rec.SETFILTER(<Field>, <Filter>, <Placeholders>);

Seems simple enough right?

This will work just fine. But what happens if we do the following?

The applied filter will look like this:

AL did not manage to replace the placeholders inside the filter string, because “*” and “@” are used.

To make this work, we must use “STRSUBSTNO”:

STRSUBSTNO('<Filter>', <Values>)

That way, we construct the filter-text by ourselves and pass it into the filter string of the SETFILTER function. The result will look like this:

how-to
development
business central
setfilter
al code
troubleshooting
development tips
E-Invoicing-Formate UBL, CII, ZUGFeRD und Factur-X im Vergleich

UBL, CII, ZUGFeRD, Factur-X: Die E-Invoicing-Formate endlich verständlich erklärt

UBL, CII, ZUGFeRD oder Factur-X – diese E-Invoicing-Formate werden ständig verwechselt. Wir erklären den Unterschied zwischen reinen XML-Formaten und Hybridform

Weiter lesen: UBL, CII, ZUGFeRD, Factur-X: Die E-Invoicing-Formate endlich verständlich erklärt
Weiter lesen: UBL, CII, ZUGFeRD, Factur-X: Die E-Invoicing-Formate endlich verständlich erklärt
E-Invoicing formats UBL, CII, ZUGFeRD and Factur-X compared

UBL, CII, ZUGFeRD, Factur-X: E-Invoicing Formats Finally Explained

UBL, CII, ZUGFeRD or Factur-X – these e-invoicing formats get confused all the time. We break down the difference between pure XML formats and hybrid PDF-plus-X

Weiter lesen: UBL, CII, ZUGFeRD, Factur-X: E-Invoicing Formats Finally Explained
Weiter lesen: UBL, CII, ZUGFeRD, Factur-X: E-Invoicing Formats Finally Explained