Clarification on intersects expression engine function

#1

The doc says:

“Check if first argument (obj or arry) is present with remaining arguments.”

  1. Expr.eval(“intersects([‘b’], [‘a’, ‘b’])”) evaluates to true: Expected
  2. Expr.eval(“intersects(‘b’, [‘a’, ‘b’])”) evaluates to true: Please confirm this is automatic casting to array
  3. Expr.eval(“intersects([‘a’, ‘b’], [‘b’])”) evaluates to true: Makes sense but the documentation seems to only check that arg1 is included in arg2.
  4. Expr.eval(“intersects([‘a’, ‘b’], ‘b’)”) evaluates to true: Makes sense if 2) and 3) are expected.
  5. Expr.eval(“intersects(‘p’, ‘a’, ‘b’, ‘c’)”) throws an error (example of the documentation).

Could you comment on those points and explain the right way to use intersects?

Thank you

2 Likes

#2

The first 4 make senses because intersects accept arguments of type any behind the scene there should be some casting !
The documentation gives intersects('p', 'a', 'b', 'c') as an example but running this inside Expr.eval throws exception

Error: Wrong number of function arguments for function intersects at 1:0 in intersects('p', 'a', 'b', 'c')

I guess it was not able to construct the second argument out of 'a', 'b', 'c' or feature not implemented!

0 Likes