How to find in array?

Simple question:

Have an array with objects (from db query):

  "query_all_subdomains": [
    {
      "school_slug": ""
    },
    {
      "school_slug": "schoolname"
    },
    {
      "school_slug": "anotherschoolname"
    }
  ]

I want to check if a value exists in the array, like: schoolname.

Thought this would be easy with formatters but I think I’m missing something.

I tried the ‘contains’ and ‘where’ formatters.

I want:

When you use where you can set the type to be inarray instead of == etc

Thanks, I don’t see inarray - am I looking at the wrong place?

I’ve not played around with them much sure the team can advise i found it when I just had a simple array maybe the logic is different with this

Appreciate it anyway!
I feel like this should work what I have in the screenshot above, but it outputs an empty value.

I think you need to get the values, and then use ‘contains’, eg something like:

image

Thanks I managed to fix it right before trying this!

My issue was that Wappler was adding quotes to school_slug and schoolname

I just started over and used the code field and this prevented it.

2 Likes