Appian and(), or(), not()
Appian's logical functions in one place: and(), or() and not(), how they treat lists, nulls and short-circuiting, and how to combine them into XOR, NAND and NOR, which Appian has no function for.
Official Appian documentationThe three gates
and() is true only when every input is true. or() is true when at least one input is true. not() turns true into false and false into true.
They are functions, not operators — Appian has no and or or keyword — and they return a Boolean you can use directly. if(and(a, b), true, false), or comparing a result with true(), only restates what you already have.
They work on whole lists
Give and() or or() a list and every item is tested; lists inside lists are flattened first. That pairs naturally with a comparison, which already makes one Boolean per item:
and(scores >= 60) every score passed or(amounts < 0) anything negative
not() on a list flips each item and hands back a list of the same length.
An empty list is decided by what is missing: and({}) is true, because nothing failed, and or({}) is false, because nothing passed.
They stop as soon as the answer is known
Inputs are evaluated left to right. and() stops at the first false and or() at the first true, and anything after that is never evaluated — an error in it never happens. Put cheap, common checks first and expensive or fragile ones last.
Nulls, and values that are not Booleans
Inside the inputs of and() and or(), nulls are filtered out rather than counted. not() is stricter: not() of a null is an error.
When a value might be missing, write value <> true. It gives the same answer as not(value) for true and for false, and true — not an error — for null.
Be careful with the similar-looking value <> false. It asks "is it true, or missing?", which is the opposite of not() for true and false, even though Appian's own not() page suggests it as the alternative.
Numbers are read as Booleans — 0 is false, anything else true — but text such as "yes" is an error rather than a quiet false.
Combining gates
Everything else is built from those three. Appian has no xor(), nand() or nor():
- NAND, not both —
not(and(a, b)) - NOR, neither —
not(or(a, b)) - XOR, exactly one —
a <> bfor two Booleans, orand(or(a, b), not(and(a, b))) - XNOR, both the same —
a = b
De Morgan's laws let you move a not() inside: not(and(a, b)) is or(not(a), not(b)), and not(or(a, b)) is and(not(a), not(b)). Write whichever reads more like the rule you were given.
A test per item: all() and any()
When the test for each item is a function rather than a comparison, all(fn!test, list) and any(fn!test, list) apply it item by item — and() and or() across a list, the same way reject() filters. all() of an empty list is true and any() is false, for the same reason as above.
Official pages
Try it
Run each one and read what comes back before moving on.
1Build the AND truth table: every pairing of true and false.
a!forEach(items: {true, false}, expression: a!localVariables(local!a: fv!item, a!forEach(items: {true, false}, expression: and(local!a, fv!item))))2The same table for OR.
a!forEach(items: {true, false}, expression: a!localVariables(local!a: fv!item, a!forEach(items: {true, false}, expression: or(local!a, fv!item))))3Appian has no xor(). For two Booleans, "not equal" is the same gate.
a!forEach(items: {true, false}, expression: a!localVariables(local!a: fv!item, a!forEach(items: {true, false}, expression: local!a <> fv!item)))Hand not() a whole list.
not({true, false, true})Ask whether anything in a list is negative.
or({3, -1, 8} < 0)Put an error after a false.
and(false, 1 / 0)
1Put a null inside the list.
and({true, null, true})2Now hand not() a null.
not(null)
Independent evaluator — approximates the Appian expression language and may differ from a real Appian environment. Verify anything that matters. Terms
Exercises
0 of 7 cleared- 1and(): check that every condition holdsEasy
- 2or(): check that any condition holdsEasy
- 3not(): flip every flag in a listEasy
- 4and(): decide whether a release can shipMedium
- 5XOR: check that an order is either delivered or collectedMedium
- 6NOR: neither of two conditionsMedium
- 7and(), or(), not(): decide whether a badge opens a doorHard