How-to: search your table's object array columns in a custom query.

Hey, Builders of Xano!

We’re always in pursuit of making our tool the easiest and most powerful that we can. With great power comes great responsibility! So, we’ve recently begun adding and creating more content for beginners and experts alike. Over in support chat, we've noticed a recurring question: how do I search for a value in an array, or within an object array, of my table? Let’s answer that in this community post.

First things first, this is going to apply to our Query All Records where we can use the joins option.

While joining tables is its own thing, the joins option in this context allows us to search the table we're querying by its array or object array column.

As an example, imagine you have a table by the name of goal_info. Inside exists a column by the name of statistics, and this column is an array of objects, with each object having the property pass_percentage.

Imagine you want to find all of the records that hold an object with a pass_percentage greater than 40%.

To accomplish this, click on the BY JOINS pencil in the top right-hand corner of the filter panel. In the Table dropdown, at the bottom, select this table’s statistics column.


Be sure to save, and then navigate towards the BY CUSTOM QUERY, and click on the pencil. As an argument, you’ll now see the individual properties of the object schema. Selecting the pass_percentage adds it as an argument. Now, we can finish this statement by evaluating this argument to match our 40% criteria.


Let me know if you have any questions!

6
3 replies