Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


Gary_W
2016-12-30T17:42:57Z
New user here. I understand one cannot have a loop within a loop so I am looking for a best practice on how to proceed with what I need to do.
I have a list files task to generate a list of files that match a naming criteria within a folder.
I then have a loop to read those filenames.
Then for each filename I need to get the date from the filename, reformat it and add it to the end of each row in the file.
So to summarize, I need to loop through files, looping through each row in each file adding a column (preprocessing before another program uses these files).
Currently I have a .vbs script that does this but I am trying to do this entirely in VisualCron instead of having VisualCron call the script for each file (which does work).

Any ideas or guidance? Thank you!
Gary
Sponsor
Forum information
thomas
2017-01-02T14:59:32Z
Hi

You can create a loop within a loop, if the nested loop is a separate job/task. So something like this:
Create a job that loops that loops over each file, and extracts the date. In the loop call a separate job that takes the path of the file + the date as parameters. This second job can then loop over each line in the file and append the date.
Gary_W
2017-01-03T21:15:01Z
Thanks Thomas, I got it working. The parameter part was a little confusing but I took an educated guess and it worked on my first attempt. Maybe because I'm new to the tool and still trying to understand things. I just wish I could keep all job tasks contained in one job.

Anyway, thanks for your help!
thomas
2017-01-04T09:52:08Z
Glad it worked out. You can keep all of it in one job, if you put the second part (or both )in a .Net or assembly task, but I guess you want to avoid that.
Scroll to Top