Check out the first Dataiku 8 Deep Dive focusing on Productivity on October 29th

In a formula, how to check if a variable belongs to a set of values

A common need when doing formulas is to check whether a variable (generally, a column) belongs to a set of values.

For example, you may want to check if "mycolumn" has value 1, 2 or 3. To do that in a formula, use the arrayContains function:

``arrayContains([1,2,3], mycolumn)``

In other words, instead of checking if "mycolumn is in [1,2,3]", you check if "[1,2,3] contains mycolumn"

It is useful to remember the usual formula rules to refer the values of columns: https://doc.dataiku.com/dss/latest/advanced/formula.html#reading-column-values

For example, to do the same in a column named "my column" (note the space), you would use:

``arrayContains(["a", "b", "c"], strval("my column"))``

Labels (2)

• Preparing

Version history
Revision #:
2 of 2
Last update:
‎02-22-2020 03:15 AM
Updated by:
Contributors