I want to create a button that will delete any rows which have broken relations in any of their columns, but I don’t know how to write that as a formula.
I have a table called Projects with a two-way relation to a table called Tasks. When I delete a project, the tasks still exist, but their “project” column now references a project that has been deleted. How can I create a button that will search for any of these orphaned tasks and delete them? TIA
Not exactly what you asked for, but I think the best option would be to implement a delete button on the projects table.
The delete button would have a RunActions formula, and you would run two actions. The first one would delete any tasks rows where the project is equal to this row (the current project opened), then the second action would delete this row (the actual project).
This would make it so you cleanly delete the project and it’s tasks, leaving you with no orphaned tasks!
Thank you @Micah_Lucero ! I thought about that but figured sooner or later someone’s just going to accidentally delete the row directly instead of using the button haha. If there’s no other solution, this is probably what I’ll end up doing.
Yeah, makes sense. You can use the formula below, it should work with your proper table names!
[Tasks].Filter(Project.IsNotBlank() && Project.In([Projects]).not())
It basically says to filter tasks where the project column isn’t blank, but also where the project in the column isn’t in the projects table.
That worked perfectly! Thank you!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.