matches_filter

matches_filter 函式可用於自訂篩選器自訂欄位,用來判斷欄位值是否符合篩選器運算式

語法

matches_filter(field, filter expression)

matches_filter 函式會將篩選運算式套用至欄位,如果欄位中的值與篩選運算式相符,則傳回 Yes;如果不相符,則傳回 No

範例

如果月結單日期在 30 天內,這個範例會在自訂欄位中傳回 Yes

matches_filter(${billing.invoice_date}, `30 days`)

使用 if 函式搭配 matches_filter,即可傳回不同的值。下方範例顯示自訂欄位的語法,如果帳單日期超過 30 天,就會傳回「Late」:

if(matches_filter(${billing.invoice_date}, `30 days`), "Current", "Late")

注意事項

定義篩選器運算式的字串必須加上反斜線 (`) 字元。