How do I filter when specifying a field?

I’m trying to show the count for a database table in Xano, but I need the count to be filterable to specific items.

For example, I have different pending approvals, but I want to show a count for filtering for Approved, Denied, Pending, etc - Not just a count for everything like I’m getting right now.

1 Like

First, you need to filter the results, and then get the length of the array of items from that filter. Something like:

Length(filterByKey(collection[‘fooBar’],”ding”,”dong”))

You can see all of the noCode formulas for arrays under the array functions in the variable explorer. If you hover your mouse over the formula name, it will give you a tool tip on the syntax and how to use it.

2 Likes

Thanks Kevin, I will give this a shot.

1 Like

Hey Kevin - I’m trying to implement this, but am not sure how to properly pass the field that I should be searching on, in this case it would be request_status

Here is a screenshot, any ideas on where I’m doing this wrong?

Length(filterByKey(collection[‘fooBar’],”request_status”,”Requested”))

2 Likes

That did it, thank you!