Die Funktion matches_filter wendet den Filterausdruck auf das Feld an und gibt Yes zurück, wenn der Wert im Feld mit dem Filterausdruck übereinstimmt, oder No, wenn dies nicht der Fall ist.
Beispiele
In diesem Beispiel wird in einem benutzerdefinierten Feld Yes zurückgegeben, wenn das Rechnungsdatum weniger als 30 Tage zurückliegt:
Verwenden Sie die Funktion if mit matches_filter, um unterschiedliche Werte zurückzugeben. Im nächsten Beispiel wird die Syntax eines benutzerdefinierten Felds gezeigt, das „Spät“ zurückgibt, wenn das Rechnungsdatum älter als 30 Tage ist:
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-07-31 (UTC)."],[],[],null,["# matches_filter\n\nThe `matches_filter` function can be used in [custom filters](/looker/docs/filtering-and-limiting#custom-filters) and [custom fields](/looker/docs/custom-fields) to determine whether the value of a field matches a [filter expression](/looker/docs/filter-expressions).\n\n### Syntax\n\n**`matches_filter(field, ``filter expression``)`**\n\nThe `matches_filter` function applies the filter expression to the field and returns `Yes` if the value in the field matches the filter expression or `No` if it does not.\n\n### Examples\n\nThis example returns `Yes` in a custom field if the invoice date is less than 30 days old: \n\n matches_filter(${billing.invoice_date}, `30 days`)\n\nUse the [`if`](/looker/docs/functions-and-operators#functions_for_any_looker_expression_4) function with `matches_filter` to return different values. The next example shows syntax of a custom field that returns \"Late\" if the invoice date is over 30 days old: \n\n if(matches_filter(${billing.invoice_date}, `30 days`), \"Current\", \"Late\")\n\n### Things to know\n\nThe string that defines the filter expression must be enclosed in backtick (\\`) characters."]]