Have Group By/Aggregate/Sort for an Array like Queries have

Options
I would like to be able to apply the same group by/aggregate/sort that query output has, but to an array variable.

The scenario I have run across is as follows:

1) Run a query to get a list of Trello cards that I have imported to the Xano database

2) Currently, I post-process the query results array in a Xano function. The reason for this is that there are a few Trello cards that need to be individually removed (test cards and such) but I don't want to remove them in the query otherwise I would have to do that same removal across many queries. So, I have centralized the removal of the cards in a function that I can reuse after any relevant query

3) My dilemma shows up when I realized that I wanted my API to return two main groups of information.

-- A group of info with an aggregated list of cards with a count for the number of each card grouped by the columns they are associated with, in Trello...[{"list": "In Process", "count": 3}, {"list": "done", "count": 8}]

-- A group of info with the full list of post-processed cards from the query (after running them through the post-processing function)...
[{"title": "do a thing", "list": "In Process", "card_url": "https://a.com/44ks"}, {}, {},... {}]

 The issue is related to how I get the grouped/aggregated/sorted result from a query, that can do aggregation easily, but doesn't have the post-processing function applied.

The result is that the aggregated data has more cards than the post-processed data since I have to do the aggregation in the query and can't apply the post-processing function to the results after they have been aggregated.

My thought was that it could be helpful to be able to do one query to get the list of all cards, run the list through the post-processing to remove cards, and then run the "cleaned" array through a Utility Array function that allowed me to do the same group by/aggregate/sort that a query does but only to an Array variable.

This all came about because I wanted to have a screen that has a chart of the card count by Trello List/column and also have a table of all the cards. I liked the idea of getting this data in one API call (2 groups of data) so I know the grouped data will always match the count of detailed table data.
[image.png]

Comments

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    Hey Steve, I definitely see the usefulness of having this for an array variable in addition to the query. We can certainly look at adding it to the future roadmap, but probably won't have anything like this in the immediate future. 
  • Steve Stava
    Steve Stava Member
    Options
     That sounds great. I am not in a hurry, mainly trying to get better about recording things that I find in the moment 😃. Thanks!
  • Ivan Oboth
    Options
    My current need as well 😕