How to store and show the latest created record in a collection?

Hi ,

What I need to do:
I’ve got two collections - Tasks and Task_Log. A user is assigned her individual tasks from the Tasks collection. Each time a user performs a task from her list, I create a new record in the Task_Log for this particular task. So it’s a progress tracking feature.
Then I need to show to a user only one record from a Task_Log collection - the earliest created. I need to do this for each her task. So a user can see whether she is done with her tasks for today or not.

Solution 1 - doesn’t work
I create a nested list - a list (Task_Log) within another one (Tasks).
I do this: sorting Task_Log list by created date earliest to oldest → show maximum number of items = 1. As as result I would expect it to show the earliest record of Task_Log list for EACH record of Task collection. However, Adalo shows only ONE earliest record across ALL records of Tasks. A bug or a design choice?

Solution 2 - doesn’t work either
I create a third collection, Task_Completion with a property Latest_Date. Task_completion should store all latest dates of task completion per each task. So each time a user logs in a new task completion entry, I try to update Latest_Date from the Task_Completion list. But it doesn’t update. Task_completion relates to Users, Tasks, Task_log collections.

Am I doing something off? Any alternative solution?

Thanks a lot!
Denis

1 Like

I think you just need to flip your lists around from Solution 1.

Nest the task_log list within the list of tasks instead. That way, you can filter the task log list with Current task > task_log. Max items 1, sort by newest to oldest. Just like how you pictured.

1 Like

Task list

Nested list of task_log

I created 3 tasks to demo with 6 task log entries.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.