For the sake of simplicity I’ll try to bring my problem to the most basic form.
I have 3 types of things:
Document - a thing that has: 1) a field with a Folder (the one it’s in), 2) a field with a Both related to this Document
Folder - a thing that has: 1) a field with a list of Documents (the ones inside), 2) a field with a Both related to this Folder
Both - a thing that I use to display the two above in one RG; it has: 1) a field Folder that defines the represented Folder, 2) a field Document that defines the represented Document, 3) a field ParentBoth that represents the Both it’s inside of.
I want to make a workflow that deletes all Documents and Folders that are inside a Folder a user deletes.
Right now my workflow looks like this:
Button “Delete” in my RG is clicked.
Delete the Folder or Document related to the Both.
Delete the Both.
Delete a list of Boths - Do search for Boths that have have no ParentBoth
Delete a list of Folders - Do search for Folders that have have no Both related
Delete a list of Documents - Do search for Documents that have have no Both related
Results:
The Folder and it’s Both are deleted. Success.
All Boths that were “inside” are deleted. Great.
No Folder or Document that was inside is deleted. And it’s despite I can see in the section “App data” that they have no Both related!
Only when I delete another, totally unrelated Folder that those things are deleted properly.
I believe here’s a problem with timing - deletion takes more than bubble needs to go to the next action. Is there a way to overcome it? Delay the next action till the previous is performed?
Would love to hear your thoughts. Thanks in advance!
I tried to make it work with scheduled events but it got me only to the point, where things 1 level below are deleted.
That’s some progress but…, if I have a Document in a Folder in a Folder, then deleting the highest level Folder doesn’t delete the Document.
@robert and @jennifervasilenko, I’ve run into similar scenarios where it’s important that each subsequent step waits until the previous step has finished. The only way I’ve been able to make that work reliably is to have buttons for each step that also prevent the other buttons from being active until the previous step has finished.
Is there a more user-friendly way? It’s definitely not professional-looking.
Yes, there are better ways. If something is dependent on another thing happening first (i.e. Step 1 before Step 2, and so on), then break out your workflow into separate workflows for each step, where the final action in the workflow triggers the next workflow (or better yet, schedules the next workflow with a 0.2 second delay).
No, I don’t see any easy way to do it.
I don’t store in a Folder’s field every single thing that’s inside - only the first children. I would first need to recursively find the lowest level child and move upward but there may be many nested folders on different levels so it seems to be a much worse approach.
As I see it, deleting a parent and searching for things that have no parent (but should) is a way clearer.
Nonetheless, why would it matter?
Edit:
I’d like to point out that I set 5s delay to make sure everything has time to be deleted so I suppose time is not the problem. The only reason I can think of is that Bubble doesn’t allow for creating loops. But is that true?
And good to know loops aren’t the case. Perhaps, I’ve made some logic mistake somewhere.
Btw, is it a regular behavior that when I run the process in the step-by-step debug mode the result of “Delete -> Do search for” is empty, yet I can see in the “App data” section that the things were deleted?
It’s like the action was already performed and the data displayed in the debug window is from the end of the whole process that I view step-by-step.