I have tried what seems like everything to get the data for the ListView filtered to only include the appropriate values for the appropriate years. (You can see that each list is identical.)
get_all_years is a query that gets all of the distinct years from my data, and is the datasource for the GridView. get_all_series is a query that gets all of the distincy series from my data, which includes a "year" property.
I was hoping to call get_all_series once, and then have the option to _.filter() the records for each ListView based on the year used by the parent GridView, but this seems to be eluding me.
Hi @jeffblankenburg! Can you try wrapping get_all_sets_by_year.data with formatDataAsArray -- e.g. formatDataAsArray(get_all_sets_by_year.data).filter(() => ...)
This should verify that your data is an array before you filter it.
Hi @MiguelOrtiz,
Learning retool through trying to replicate code provided and here come a cropper for some reason.
Using the Array_Aggr as below
SELECT p.id, p.name, ARRAY_AGG(c.name) AS children
FROM "parentGuardianA" as p
join "childA" as c on c."parentID" = p.id
group by p.id, p.name
returning return formatDataAsArray(data);
When I populate the gridview using {{item.name}} and the list within using {{item.children}}, the list is showing all children for each parent but if I just output the data as below, it is fine. What am I missing?
Apologies if it took me a while to get back to you. So I just made a quick example. My query is the following (and it is transformed using return formatDataAsArray (data) ):
SELECT
c.id,
c.company_name,
ARRAY_AGG(DISTINCT jsonb_build_object('id', con.id, 'first_name', con.first_name, 'last_name', con.last_name, 'company_id', con.company_id)) AS contacts
FROM ps1.company c
JOIN ps1.contacts con on con.company_id = c.id
group by c.id,c.company_name
It returns this:
And so in my first listView data source I have the query as data source. In the nested list view my data source is {{item.contacts}}