Activity Feed: List of last activity by each user - most efficient way?
Options
![Ryan Anderson](https://us.v-cdn.net/6037124/user_avatars/2322716.jpg)
Ryan Anderson
Member ✭
I have a list of Activities performed by multiple users. A user can perform multiple activities in a row.
I want to return a list of that contains only the latest activity by each user in a list.
Last Activity by User 1
Last Activity by User 2
Last Activity by User 3
Given there could be many thousands of entries, what would be the most efficient way to approach this?
Would I use the new Stream functionality with a loop?
Or can this be done with Aggregate return somehow?
I want to return a list of that contains only the latest activity by each user in a list.
Last Activity by User 1
Last Activity by User 2
Last Activity by User 3
Given there could be many thousands of entries, what would be the most efficient way to approach this?
Would I use the new Stream functionality with a loop?
Or can this be done with Aggregate return somehow?
Comments
-
Hey, Ryan. It depends a little bit on your database structure here; are you hanging on to only a single activity in your database, or keeping a list of recent activities and only want the most recent?
-
So it’s coming from one big table of ALL activity (because this data is used for a lot more) that looks something like this:
created_at
created_by
company_id
And then a bunch more fields describing the activity.
So I want to take a list of data like this (which will always be filtered by company_id):
User 1 | 26 September
User 2 | 20 September
User 1 | 8 September
User 2 | 4 September
User 1 | 3 September
And return a list like this:
User 1 | 26 September
User 2 | 26 September
By the time I filter by company_id and a created_date of 7 days, the largest number of total activity records returned would be about 50,000 but on average it will be more like 1,000 - 2,000 records. -
Still haven't figured how to make this happen @ - any ideas?
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback