Basic question : Linking sub-tasks to a task

Hello there,
I’m learning and made good progress on the to-do app from the lessons.

My question, how do I add Sub-Tasks to an existing Task? My current thinking is as follows

  • Have a Task thing, and the SubTask thing.
  • when adding a new sub-task, add the SubTasks’s unique-ID to the current task list item, in a list field.

The repeating group for the sub-tasks would only display sub-tasks for the given Tasks’s unique-ID.

It should work similar to the lesson “Defining a field as a list of things”, but I can’t make it work.

Your help is more than welcome.

Than you.
H.

On the main Task, you can create a list field called “Subtasks” and make it of type Subtask. You don’t need to fiddle with Unique ID’s anywhere…you can just add “this subtask” to “this task.” If you go this route, you might not even have to have a specific Data Type for “Subtask.” They can all be tasks, but if you put a List of Tasks on another Task, you can visualize those as subtasks.

1 Like

Thank you for your quick reply. This sounds much more elegant.

This helps, a bit. Unfortunately the new sub-task is added to all tasks, not just one. That’s why I thought using the unique-ID would be useful.

For learning purpose, I want to mimic MS ToDo

I see your issue. You aren’t making a change to a list of TaskLists…you’re only making a change to a single TaskList. You are updating a list within that single item, but in English, what you are currently saying is this:

“Find me all the TaskLists that exist and add this subtask to every one of them”

What you want to say is this:
“Get me the single, specific TaskList I want to update, and add this subtask to it.”

1 Like

Pretty much this. I spent another hour.

I ended up to store the current cell number in a custom state Row.

When creating a new sub-task, I use Row’s number to add the new item to the list of sub-tasks in the task list:

Finally, the repeating group is filtering for the stored IDs
image

There might be more elegant solutions, but this works for now. When clicking on a task, the referenced subtasks are shown.


Thank you!