Is there a simple way to make a recursive call on a callable function? For example if I want to browse over folder->subfolder list in a application and then do some actions on the files in the folders, what would be best approach to do that, if folder depth is not known in advance?
As I see at the moment, I can not call callable recipe from itself. Current workaround I found is that I created 2 identical GetSubfolders callable recipes, ant if recursion is needed I can call GetSubfolders2 from GetSubfolders1 and vice versa, but it does not seem very elegant.
What is the reason of not letting callable recipes to be recursive and call themselves?
Best Answer
M
Marlon Muela
said
over 3 years ago
Hi Justinas,
Currently, Callable recipes > Call recipe action only allows another recipes to be called.
The call recipe action is designed to execute the same callable recipe as it may cause infinite job loops if not used properly.
If you are trying to perform actions within a list of files in a folder, you can use a repeat action.
1 person has this question
Answer
Marlon Muela
said
over 3 years ago
Hi Justinas,
Currently, Callable recipes > Call recipe action only allows another recipes to be called.
The call recipe action is designed to execute the same callable recipe as it may cause infinite job loops if not used properly.
If you are trying to perform actions within a list of files in a folder, you can use a repeat action.
J
Justinas Lipnickas
said
over 3 years ago
Thanks for reply Marlon.
I understand, that a recursive function should be used with care as there is a big risk of infinite loops. I can of course call the callable recipe over the REST call, or can have that recipe use web hook for a trigger..
As for using list to perform actions on a folder contents, that I of course already do. The challenge here, was that I also want to perform actions on file in the sub folders of the folder, and I don't know in advance how many subfolder levels are there, so recursive call was the most feasible solution in this situation.
Marlon Muela
said
over 3 years ago
Hi Justinas,
Looking at your use case, it may not be the easiest or convenient way but you can duplicate callable recipes to satisfy the condition. Which I think is what you already did. Currently, a callable recipe cannot call it's own recipe trigger within the same recipe.
R
Robin Peters
said
over 3 years ago
I need the "recursive" feature too. I will solve it same way for now with cloning the recipe and call vice-versa.
Justinas Lipnickas
Recursive callable recipes
Is there a simple way to make a recursive call on a callable function? For example if I want to browse over folder->subfolder list in a application and then do some actions on the files in the folders, what would be best approach to do that, if folder depth is not known in advance?
As I see at the moment, I can not call callable recipe from itself. Current workaround I found is that I created 2 identical GetSubfolders callable recipes, ant if recursion is needed I can call GetSubfolders2 from GetSubfolders1 and vice versa, but it does not seem very elegant.
What is the reason of not letting callable recipes to be recursive and call themselves?
Hi Justinas,
Currently, Callable recipes > Call recipe action only allows another recipes to be called.
The call recipe action is designed to execute the same callable recipe as it may cause infinite job loops if not used properly.
If you are trying to perform actions within a list of files in a folder, you can use a repeat action.
1 person has this question
Marlon Muela
Hi Justinas,
Currently, Callable recipes > Call recipe action only allows another recipes to be called.
The call recipe action is designed to execute the same callable recipe as it may cause infinite job loops if not used properly.
If you are trying to perform actions within a list of files in a folder, you can use a repeat action.
Justinas Lipnickas
Thanks for reply Marlon.
I understand, that a recursive function should be used with care as there is a big risk of infinite loops. I can of course call the callable recipe over the REST call, or can have that recipe use web hook for a trigger..
As for using list to perform actions on a folder contents, that I of course already do. The challenge here, was that I also want to perform actions on file in the sub folders of the folder, and I don't know in advance how many subfolder levels are there, so recursive call was the most feasible solution in this situation.
Marlon Muela
Hi Justinas,
Looking at your use case, it may not be the easiest or convenient way but you can duplicate callable recipes to satisfy the condition. Which I think is what you already did. Currently, a callable recipe cannot call it's own recipe trigger within the same recipe.
Robin Peters
I need the "recursive" feature too. I will solve it same way for now with cloning the recipe and call vice-versa.