I can’t get the ‘includes’ operator to show up in an expression.

What I’m trying to do:

I have an array of objects I’m searching through using the ‘Array - Find All Elements’ function. For a said Object being iterated on (which is represented by the ‘$this’ variable in the expression builder) I want to compare a text field in the Object with a text variable from my input (which is a search query) to see if there is at least a partial match between the two text strings. So I would like to use the ‘includes’ operator as its the closest thing to fuzzy search functionality in this scenario.

The expression I’ve been trying to achieve is something like: (Array - Find All Elements) where $this.service.service_name includes search_query (== true).

The problem stopping me from doing this:

I simply cannot get the ‘includes’ operator to pop up / be available, no matter what. I understand that when it comes to functions outside of ‘Query All Records’ a query operator like ‘includes’ becomes a filter, and as such I’ve tried many things regarding filters to get it to pop up in the filter options menu (explained in the next section) - all were unsuccessful, even when I tried the ‘Query All Records’ function on a random test just to see if the ‘includes’ operator would be there, it still wasn’t present.

What I’ve tried:

  • The ‘json_encode’ filter on the object path, I thought maybe the path not being recognised as type text was why the ‘includes’ filter wouldn’t show up

  • ‘to_text’ for the same reason as above

  • Starting the expression with the text variable from my input first

  • Removing the ‘$this’ variable from the expression so that the input box recognises the field I’m parsing as type text.

  • Tried some other stuff but it was mainly scratching at solutions.

Any help is appreciated, thanks.

https://docs.xano.com/api/api-builder/configure-an-expression

1
4 replies