Skip to main content
Known Participant
Feb 3, 2022 6:45 PM UTC
Question

check if element is 0 in an array

Hi there,

I know I can use any function to check any element is null in an array like this:

any(fn!isnull, {0, null, 30}).

how to use any function to check if any element is 0?

Thank you.

Lin

3 replies

agamb0001
Participating Frequently
Feb 3, 2022 6:50 PM UTC

Hi Lin,

You can try something like:

or({0,null, 30}=0)

OR


contains({0,null, 30},0)

linp0001Author
Known Participant
Feb 3, 2022 6:56 PM UTC

Thank you.

harshitb6843
Brainy
Feb 4, 2022 6:06 AM UTC

Hi there,

You can you the contains() to just get true and false. You can also use whereContains to get the index of the element that is 0. 
There are many more methods to do this but really depends on your use case here.