Negation of 'arrayContains' in the Formula Language?

PANKAJ
PANKAJ Partner, L2 Admin, Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Registered Posts: 26 Partner

suppose I want to do a SQL condition using the formula inside the prepare recipe.

Query: ( ID IN (11,12,13) AND CITY NOT IN ('LA','NY','CA')) OR (ZIP NOT IN (111000,111011))

In formula language in Dataiku :

(arrayContains([11,12,13],'ID') {# for IN} && ---------???--------) OR (-------???-------)

what to write for 'NOT IN'?

Answers

  • AgatheG
    AgatheG Dataiker, Registered Posts: 37 Dataiker

    Hi Pankaj,

    You can use not() to have the opposite of a statement. In your case, evaluating that an array does not contain an element could be done with not(arrayContains(YOUR_ARRAY, YOUR_VALUE).

    See more about boolean functions in Formula in the related documentation: https://doc.dataiku.com/dss/latest/formula/index.html#boolean-functions

    You can also use directly ! : !arrayContains(YOUR_ELEMENT, YOU_VALUE)

    Hope this helps!

    Agathe

Setup Info
    Tags
      Help me…