IF "List Files Node" don't find a file, try next item on GroupLoop Start.

Hi friends.

I want to iterate over a group loop star and base on the values of that group, search files inside a folder and do all the group loop until the end and then start over again for the second item e so on. (I just describe the group loop concept)

But if the first or any iteration doesn’t find any file, my flow stops.
So want to try the next iteration before the Loop End node

Let me show:

1-I have this table with two company codes

2-I group loop star with that code.

First iteration (one row)


3-I transformed the first row into a variable

4-Then I used the List Files Folder node.
PS: inside the folder, I only have 1 file, and in the name of the file exists the company code “000363”

But, the first iteration, is using another company code, and the variable has this value for the first iteration “000100”.

5-Inside the configuration in List Files Node, i use the variable to filter files that have that particular code:


Because doesn’t exist the file from the first iteration, my List Files node stops;



What I want:
IF the List File Node doesn’t find any file, try the second iteration.

It is possible?

I have tried this but it is not working:


The loop don’t start the second iteration. :cry:

I have searched and I think I am on the right way, but my Loop end doesn’t start over.

I include a loop end and loop start, because on my A-Star loop the End loop is if the table is not empty.

I attached the example.
How to use the table with all the codes.

Test_Loop empty table.knwf (33.2 KB)

Hi @Felipereis50 , I’m not quite sure how you want this to work, or the full actions to take if a file does or doesn’t exist, but the workflow you uploaded doesn’t terminate either the conditional branches, nor the outer loop:

You cannot terminate a loop inside a conditional branch if the loop started outside, this cannot work.

You would need your structure to look something like this for it to be correctly terminated:

As it stands, the final Loop End would need to be configured to “Allow changing table specification” as the output from the inner Loop End will differ depending on the branch chosen.

However, whilst the above structure is consistent, I don’t actually know what it is that you are wanting to do within the loop if the file does/doesn’t exist. Probably you are wanting to perform additional logic there?

I also haven’t worked out why you require the second (outer) loop.

What is the aim? Is it to find the first file in the list that exists?


Hi friend.

I know that my flow is missing 1 loop end.
I’t’s because my original flow is very big, And If I show It, won’t add anything to the explanation.

my original flow, is working fine.
I have 3 group loop and 3 loop end.

But, when I was testing it, if a file is missing or don’t exist for the group loop start “dim table” with all company names, , I have got an error, because I use that group to filter the name of the file.

So when I created an example of the flow, if the file exist it will pass through “empty table” first output, end go on all the end…
is not find the file, should pass through second output of Empyt table and start the second group loop row to find a file and on and on.

But I will test your flow explanation example and I will return to you later.
I think I understand your example with the photo.

Hi @Felipereis50 , thanks for the update. I will await further information. I’m not expecting my previous example to resolve your problem. You said the loop you had wasn’t working so I assumed that the workflow you posted was a full example of the problem and my observations were given in that context.

I still don’t understand the necessity for two (or three…) nested group loops. If you could post a reduced (but logically complete) minimal example of your workflow, along with a description of your intention, I will try to assist.

Hi friend.
Sorry late,

I don’t know how to explain it exactly.
But my original flow is big and I haven’t encapsulated it in the metanode yet because I want to have a view of the whole until it works.

My flow has several group nodes, 4 group and 4 End, one inside the other.
It’s difficult for me to explain, but it’s because I have to do a pipeline inventory control and I need to propagate the variables to the original group for each SKU.
I tested and all the flow works perfectly.

Leaving that aside.
My flow started with just a “List Files” and
But I Want to filter the files inside Lis Files with a “dim” table.
Filtering by name.

To do that, I created the flow that I showed to you.
But if the filter doens’t find a file the flow stops.
When this happens, I want to try again with the nest values.
And to do that, I inserted a new Group Loop to group de Dim Table one, by one.
Now its a total of 5 group loops, and I need close with a Loop End.



But you gave me a light on your flow.
Thanks my friend.
I will try something here. :slight_smile:

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