Hi!
I have a text file containing lines with paths and filenames.
I would like to iterate though this text file, extract each path+filename and do some processing on each file.
How do I do that?
Br
Iterate through text file
Re: Iterate through text file
Hi molped, thank you for using FFAStrans and welcome to the forum!
If your text file purely consists of paths separated with a new line then it's quite easy:
First you must use a "Populate" node to populate a user variable with the readout of your textfile. Then you connect a "Foreach" node to dynamically create branches for each path:
Note that in the "Foreach" node it says "Array string" but it will also accept the kind of text you're supplying with new line separated paths. Try it and report back
-steinar
If your text file purely consists of paths separated with a new line then it's quite easy:
First you must use a "Populate" node to populate a user variable with the readout of your textfile. Then you connect a "Foreach" node to dynamically create branches for each path:
Note that in the "Foreach" node it says "Array string" but it will also accept the kind of text you're supplying with new line separated paths. Try it and report back
-steinar
Re: Iterate through text file
Hi steinar,
Thank you for helping!
I tried setting up a test workflow:
A populate node, a for-each and a command executor, thats runs a batch file which will do some work.
The populate node should read lines from the text file TV.txt.
The for-each stores the read lines into %s_source% which is then fed into the command executor.
It seems that nothing happens - am I missing someting?
Thank you - and keep on the good work on making this great tool even better!
Thank you for helping!
I tried setting up a test workflow:
A populate node, a for-each and a command executor, thats runs a batch file which will do some work.
The populate node should read lines from the text file TV.txt.
The for-each stores the read lines into %s_source% which is then fed into the command executor.
It seems that nothing happens - am I missing someting?
Thank you - and keep on the good work on making this great tool even better!
Re: Iterate through text file
I see you have no monitor for triggering input sources. Do you use manual submit via GUI or the API? The populate node itself does not do anything itself until it's triggered. If you have neither, you can just submit a bogus file to the workflow just for triggering.
-steinar
-steinar
Re: Iterate through text file
example workflow. Submit any file to the text file processor, it does not matter which file you submit as the workflow discards it and instead automatically writes a text file to simulate your input text file.
emcodem, wrapping since 2009 you got the rhyme?
Re: Iterate through text file
I inserted a monitor node, and it works!
Is it possible to trigger a workflow eg. on a set time of day?
Thanks for your help!
Is it possible to trigger a workflow eg. on a set time of day?
Thanks for your help!
Re: Iterate through text file
Hehe yeah something has to trigger the workflow, be one a monitor processor, manual submit, api...
The webinterface has a scheduler builtin that allows you to trigger workflows based on a specific frequency. When you do that in high frequency, e.g. every minute, you want to make sure that you delete the job from the logs after it is finished successfully. See last comments in the webinterface forum thread.
The webinterface has a scheduler builtin that allows you to trigger workflows based on a specific frequency. When you do that in high frequency, e.g. every minute, you want to make sure that you delete the job from the logs after it is finished successfully. See last comments in the webinterface forum thread.
emcodem, wrapping since 2009 you got the rhyme?