Rules
Any, all and not
A café needs an alcohol licence if it is a bar, or if it sells wine. That is two answers, and either one is enough.
any holds when at least one of its conditions does. includes tests whether a checkbox is ticked:
when: {
any: [
{ field: "kind", equals: "BAR" },
{ field: "extras", includes: "WINE" },
],
},
Add a licence number shown on that when:
{
key: "alcohol_licence",
type: "text",
label: "Alcohol licence number",
when: {
any: [
{ field: "kind", equals: "BAR" },
{ field: "extras", includes: "WINE" },
],
},
},
Pick Bar, then pick Coffee and tick Wine: the question shows both times, and goes away when neither is true.
all holds only when every condition does. not: true turns one condition around, and in: ["BAR", "PUB"] matches any of several codes.