Negation of 'arrayContains' in the Formula Language?

PANKAJ
Level 3
Negation of 'arrayContains' in the Formula Language?

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'?

0 Kudos
1 Reply
AgatheG
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

0 Kudos