Decode
4 min
compares one expression to one or more other expressions when the base expression matches a search expression, returns the corresponding result expression when no match is found, returns the default expression when specified, or null when it is not this function is similar to an if then function syntax decode(expr, search, result \[, search , result] \[, default]) enabled for for a description of the business object categories, see notes on "enabled for" docid\ u26v9fecfs6ilwa0 pvjd business object category yes/no business rules before save rules yes business rules calculation rules (after save, with or without also recalculate on load) yes business rules calculation rules (before save or always, without also recalculate on load) yes business rules calculation rules (before save or always, with recalculate on load) yes business rules editing rules yes1 business rules initialization rules yes business rules read only rules no business rules required rules yes1 business rules validation rules yes client expressions no object permissions no services yes ldap yes mobile yes quick actions (except ui quick actions) yes ui quick actions no reports yes search/dashboard without field references yes search/dashboard with field references no 1 except when this field appears on a form or is triggered by such a field parameters this function must have at least four parameters, and can have an unlimited number of parameters parameter description expr expression to evaluate search text to match exactly with the search expression result value to return if the previous search text is matched default value to return if no matches are found return value number value or text value example $(decode(impact, "high", 1, "medium", 2, "no matches")) if the field called impact has the value high, then this functions returns 1 if the field called impact has the value medium, then this function returns 2 if the field called impact has any other value, this function returns the text value "no matches"
