"IF" returns error for false result (what is expected behaviour?)

I look for index of obj in array. If it is not found : returns “-1”
if array contains obj then I want to return OBJ[index].parameter

Help me to understand how this supposed to work.

On screenshot you can see that index is “-1” (i get it from previous action in workflow)

Then I check if its <0 then return 0 OR run formula with positive index

so for index>=0 my formula works well

It returns error when index = -1
I thought IF (-1)<0 THEN return 0 should immediately 0 and do not try formula because there can not be calculated without positive index…

Please clarify what am I doing wrong here?

1 Like

when result.index is -1 getByIndex returns undefined and getKeyValue throws an error because it needs an object. The first argument of getKeyValue should default to an empty object if getByIndex returns undefined, or just use an if else statement instead of the nocode if function

Thanx! With real condition if else that perfectly works!

Would be nice for weWeb team to make it clear somehow or add additional feature for “if” formula because i assume this confusing behaviour and newcomers spend a lot of time trying to debug that…

1 Like