Feature request: first() and last() aggregations

I would like to have a table aggregation “first” (and “last”) that obeys whatever sort order I put on the underlying query. Is this a reasonable request?

Hey @wz2b,

One way that we occasionally use to do this is to just add a limit of 1 record to the query, this will return just the first record. Do you have a usecase where this wouldn’t work?

Pete

Maybe. Or perhaps I just don’t know how to do it. I’m trying to take that ONE RECORD that matches the query (there should only be one) and put it into a record placeholder.

Here is a little more detail on how I would do this

Query-
Just sorting by most recent, limit of 1.


Aggregation-
Return Unique IDs

Query and then aggregation added to app

Save the aggregation to an array, pop the only ID from that array, load record.

Does that make more sense?
Pete

1 Like

Yeah. Thanks for walking me through that step by step.

To be fair, I forgot an aggregation was needed too! Would have explained it more initially if I remembered this detail!

Glad we got it sorted!
Pete