Create New Array From Existing Array

Options
Hi there, I'm looking for some help with the following scenario:
1. I have a variable called "All Inquiries" that is the result of a database search. 
2. Now I'm trying to create new variable ("Accepted Inquiries") by searching through "All Inquiries" for records where "status" = "Accepted"
3. I'd like to be able create other variables by searching through "All Inquiries" or even "Accepted Inquiries" by applying constraints to the source list.

My preference is not to execute new database queries in order to create variables that are just a subset of my "All Inquiries" list. I suspect this is probably straightforward, but I'm missing something since I've only been on Xano a couple of days.

P.S. I've included screenshots of what this looks like when I did it in Bubble (custom states in Bubble = variables in Xano). 

Step 1: Search the database and save results to a variable called "All Inquiries"

[image.png]
Step 2: Create a new list by filtering "All Inquiries" for only records with status = accepted
[image.png]

Comments

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    Hey  - didn't we show you this during office hours this morning or is this something similar but unrelated?
  • Benedict A
    Options
    Hi  - Sean showed how to aggregate a list (group by status, then count), and then create a variable that is a sum of all the counts for all groups. I'd hoped to use the same approach to tackle this, but haven't been able to figure it out. Thanks!
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    Ok got it...

    So you have
    1. Query All Records from All Inquiries - this aggregates a list grouped by status with a count
    2. create a variable that sums the counts for all groups

    You want to next...
    • create a variable that contains the records from the first Query where status = accepted

    Apologies but the Bubble screenshots do not help me 😅  Your Xano DB schema and endpoint/query set up would... you can also DM me the endpoint too - that would probably be most efficient