How To Look for Values in an Array Using array.contains
You may be familiar with the IN
operator, used in SQL.
There is a function in transformations with the equivalent functionality, called array.contains
. To find examples on how to use array.contains
, control+click or command+click (depending your OS) on the function in your code editor. This will open the function docs for this function, where you can read the arguments and see a comprehensive list of live-tested examples of how this function behaves.
Take the following code, for example.
SELECT array.contains(array, string) AS array_contains_item
This will transform this table:
array | string |
['how', 'are', 'you'] | 'you' |
to this:
array_contains_item |
true |
To view detailed documentation for any function, you can control/command+click on it, click the link to function docs on the top right of your transformation panel, or go to <instance-url>/function-docs
, e.g. http://tamr.mydomain.com:9100/function-docs
(replace "tamr.mydomain" with your Tamr domain address).
For more information, visit the public docs on Array Functions.
Updated over 2 years ago