How to check in an element is in a list by creating a custom dimension?

I want to write something in a custom dimension to check if :

for a id, there are many rules that apply to this id and some rules don’t, I have a list of id, and another list for each id of the applicable rules I want to write something so the new dimension shows if a specific rule applies to this id.

Is the list you would be checking against another dimension?

If not and it is a small, list of constants, you could try something like follows

if(
  matches_filter(${currency_exchange.currency_from}, `USD,GBP`),
  "GREEN",
  if(
    matches_filter(${currency_exchange.currency_from}, `EUR`) AND ${currency_exchange.currency_to} = "NOK",
    "RED",
    "YELLOW"
  )
)

which translates to

CASE
    WHEN (currency_exchange.currency_from IN ('USD', 'GBP')) THEN 'GREEN'
    ELSE CASE
        WHEN ((currency_exchange.currency_from) = 'EUR') AND (currency_exchange.currency_to = 'NOK') THEN 'RED'
        ELSE 'YELLOW' END
END