PICK_OR_DEFAULT

Description

PICK_OR_DEFAULT takes an input value, a list of allowed values, and a default value. If the input matches one of the allowed values (case-insensitive, whitespace-normalised), it returns the matched value from the list. Otherwise, it returns the default.

This is useful for normalising free-text input against a known set of options.

Example

p is Person
PICK_OR_DEFAULT(p.salutation, ['Mr', 'Ms', 'Mx'], 'Mx')

If p.salutation is "mr", "MR", "Mr", or "mR", this returns "Mr". If it does not match any option, it returns "Mx".

Last updated

Was this helpful?