What formula to use to check if an item is a subitem of a subitem?

Hi there, I’m a bit stuck on the use of CurrentValue.

My current project involves building a taskboard where tasks can have subtasks. Those subtaks can have subtasks as well, etc. These are all linked relations on the same taskboard.

I want to prevent the user from selecting a task as subtask for if it’s already a subtask of a subtask of the current task.

Case sample:

  • Parent task 0
    • Child task 1
      • Child task 2
  • Parent task 1
    • Child task 3
      • Child task 4

When clicking the dropdown for subtasks of Parent task 0, I do not want to show Child task 2, 3 and 4. I do want to be able to select Parent task 1, making it a subtask of Parent task 0.

I tried filtering it out with CurrentValue, but then it just references itself in the last CV reference:

CurrentValue!=thisRow AND [Bovenliggend issue]!=thisRow AND Not([Sub issues].FormulaMap(CurrentValue.[Sub issues].Contains(CurrentValue)))

Who can help me solve this riddle of logic?

Warm regards,
Freerk

ps. I’m stuck for the first time in a long while, so yay to all the amazing guides already out there!

Hi @Freerk_Lap,

can you please share your doc or make a dummy doc and share it?
This would really help me understand your situation better.


Sincerely
Jannis

1 Like

@Jannis here is the link to the doc: https://coda.io/d/_dH4rW7b1mOK/DB-Issues_suhAg

The table is called DB Issues, and the related columns are Parent issue and Child issues.

Hi @Freerk_Lap,

thanks for sharing your doc.

I looked into it, but unfortunately couldn’t find a condition to filter the selection consistently.

I would suggest changing something in the structure of the document so that you have a clean hierarchy.
If you have a clean hierarchy in your table, filtering is much easier.

Please take a look at this topic, which helped me a lot in building a task hierarchy:


Sincerely
Jannis

Thank you Jannis. I’ll try and find a way to improve the hierarchy.

1 Like

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