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


Jamie Jensen
2018-07-10T21:38:05Z
I have a folder that is watched by a trigger. A payroll job is processed and places 4 files into the folder and then VisualCron is supposed to notice the files, upload them, move them to a different folder and email the results.

It works however, I think it is attempting to run 4 times. After the tasks all run the first task (list files) runs again and errors because the files have been moved. At this point the job stops.

What I think is happening is that the job is trying to run 4 times because there are 4 files. If this is true is there a way to make it run only once on the 4 files?

Thanks,

Jamie Jensen
Sponsor
Forum information
Support
2018-07-11T19:38:27Z
Yes, this is default behaviour so that each Job run is unique with its Variables (of file name etc). What you could do if you do not want this is to edit Job and uncheck Put Job in queue and set it to Not run if it is already running. Then you could start with a Wait Task. Set a desired wait time when you know that all files are there. Then you can upload al files or what you want to do.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Jamie Jensen
2018-07-11T19:57:49Z
There isn't a specific time or day that the job runs. It runs about every two weeks but the day and time is variable.

So it would seem that I either live with the error and effectively have to check every day for errors or ignore the errors and hope that by it crying wolf every time it runs I don't miss a real error due to ignoring the false errors.

I have tried to stop the job after the last task but that doesn't work either. Is there a reason that the job ignores the stop order?
Gary_W
2018-07-11T22:31:56Z
Are you triggering using a wildcard like *.txt? if so, you don't know all 4 files are really there, or are there in their entirety. Are the files always named the same, or at least part of all files unique? If so, you could create a trigger for each one, and link them using a dependency so the process would not continue unless all files are present. Otherwise, another way would be to use a time-based trigger instead since you really need to make sure all 4 files are there before continuing so you need to analyze the output from the first task (list files) anyway, and flows.

Check the folder every hour or whatever. On the first task's (list files) On Error tab, uncheck no files found as that condition is really ok. Then on the Flow tab, you want 2 On success flows. The first will test if the count of rows from the list files task is equal to 0. If so, that's ok so just stop. Use this as the "other value": {STRING(RowCount|{TASK(a14e9d6f-9a03-4e61-b95f-44e53f4f5976|StdOut)})}. Here I used the list files task direct ID so you need to replace that with yours. It just counts the rows of output. Adjust values accordingly so if an int32 equals 0 it will stop.

Then create another on success flow. Use the same value, but the test this time is != 4. This means there are 1, 2 or 3 files. In the flow control section, select "run notification" and select a notification that you have created to let you know that there is a problem and not all files expected have been received.

Note in the case of all 4 files being present the tasks should run as expected.

Good luck and please let us know what you end up doing.
Scroll to Top