Workflow Switch - Dependent Upon Files

Hi, I am in the middle of a workflow and the next step is dependent upon if there is a certain file available or not. If the file is in the folder, I want it to to follow one workflow. If it is not there, then I need it to follow a different flow. I have tried to use some switches but can’t seem to get it to work. Any ideas on how to break into separate streams dependent on if a certain file is there or not?

Thanks!

Hi @eckers85

This is kinda tough without seeing the workflow. In very general terms I’m assuming you are looping through something row by row. In that case I would use the empty table switch. One way as you say is your normal workflow the other way you could concatenate a dummy column to an endif switch and continue. There are a lot of little details to work through one that I can think of is at your loop end you need to allow changing table specifications.

If you are able to share an example the community could probably give better help.

I hope this helps you get started,
Jason

Hi @eckers85,

you could reuse some parts of one of my workflow:

I am currently putting a simplified solution together. Will upload the workflow once completed.

Best
Mike

1 Like

@eckers85

You can also try this node. You can actually list the files from a folder (the output is a table with filenames and paths) and then do some testing with a Rule Engine to see whether the file exists or no in a specific folder.

If the file is in the table, the Rule Engine should return a variable that takes the top branch of an IF SWITCH, if not, take the bottom branch.

1 Like

Hi Jason,

Thanks for the reply! I don’t need it to loop through each row. Unfortunately, I am unable to share the workflow because of the information it contains. Essentially, I am comparing data from three files. File A, File B, and File C. The three files are combined and pivoted into one and outputs:

employee ID | File A $ Amount | File B $ | File C $

I then have a rule-engine written so that if all three $ Amount columns match in the row it outputs “true” in a new column.
My issue is that File C is not always there. In that case, I would want the rule engine to only output “true” if File A $ Amount and File B $ match. So my thinking was to follow one rule-engine if the file was there and to follow a different one if it’s not.

How about adding a math node (Val A + Val B + Val C)/3 and have it output a column called average value. Then modify your rule engine where Val A = average value then true else false.

Would that work?

Or… Add another Rule engine ahead which File C MISSING then 0 else File C. This should allow you to keep your original rule engine node and is less steps

Thanks,
Jason

Hi @eckers85,

here you go. I added a couple of examples which I recalled that I had created as shared components once:

You will be required to install Vernalis Extension but that is a string recommendation anyway since it’s pure joy working with it.

Best
Mike

1 Like

Thanks Mike! I was able to make this work. I didn’t use everything in there, but was able to pull what I needed.

1 Like

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