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


J Kruger
2010-06-21T18:11:45Z
Hi again,

Different day, same kind of problem. I need to write the results of each of our jobs to a log file. Everything works great, no problem with the write file task where event triggers are concerned because the task only writes to the log file IF a file hits the folder and the copy task is activated.

The issue I've got is that with a time trigger, where the folder is polled every 5 minutes or whatever, the write file task records the action even if no file was there and copied. In some cases this means the log file becomes quite big and filled with rubbish basically.

Could someone hold my hand and lead me through setting up a generic condition which would ensure that the write file task only activates IF the copy file task completed (ie. a file was there, copied to new location, deleted from old location).

I don't want to have to create a new condition for every single time trigger / job combination so I need a generic file condition.

I'm using this but it doesn't work:

{TASK(PrevTask,Result.CopiedFilesSource)}

I kind of knew it wouldn't 🙂 But I can't think of anything else that would. All I want to be able to do is tick the box next to the generic condition if I have a time triggered job.

1) Time trigger set to every 5 minutes (for example)
2a) If file is there, copy file task does it's job
2b) If file is not there, job exits before write file task can do it's job.
3) Write file task creates / appends to log file ONLY IF a file was copied.

I hope I'm being clear...:)

Thanks in advance,
Judi
Sponsor
Forum information
PeterW
2010-06-22T19:51:11Z
I think I understand what you are trying to accomplish. Perhaps you could set up a condition attached to the write file task that checks the destination directory of the copy file task for the existence of the file(s). If the file(s) exist then do the write file task otherwise exit the job.

Regards,

Peter
J Kruger
2010-06-28T17:45:52Z
Thanks Peter,

I did just that and it works great for File Copy tasks - now I just need some pointers on doing the same for FTP tasks.

This is what I did:

Used Condition Type - File.

Then {TASK(PrevTask,Result.CopiedFilesDestination)} as the file path in the File Add/Edit condition window.

I set Match File: exists to False and then for the actions I have: On Match All and On Match Any - Don't wait and Exit and for On Match None and On Match Error I have Don't wait and Continue.

I tried to use similar settings for the FTP time triggered jobs but it doesn't work. This is obviously a variable issue - I used {TASK(PrevTask,Result.DownloadedFilesNames)} which I kind of knew wouldn't work but I can't think of anything else.

Are there any GENERIC task variables I can use for the file condition in the FTP task?
PeterW
2010-06-29T17:34:21Z
So basically you want to accomplish the same but with FTP tasks? You only want to write to the log file if there is a file to upload or download?

The following method should work. I will use FTP download as an example. If your destination directory for the files you download from the FTP site is, say, "C:\Production\" you could create a temporary folder such as "C:\Production\Temp\" that the FTP task downloads into. The second task after the FTP download would be the write file action but you would attach a condition to it and look for the existence of the downloaded files in the "C:\Production\Temp\" folder. For the conditions "Match All" and "Match Any" you would continue. On "Match None" and "Match Error" you would exit the job. Once the log file has been written to have a third task copy the files from "C:\Production\Temp\" to "C:\Production\". Setting the job up this way would only write to the log if files were downloaded from the FTP site.

Someone may have a more elegant solution but this is what I can think of right now.

Regards,

Peter
J Kruger
2010-06-29T17:40:54Z
Thanks Peter,

It does look a good solution 🙂 A temp folder seems to be the way to go.

Judi
J Kruger
2010-07-06T14:06:48Z
Hi ...

The solution above works just great 🙂 BUT (there's always a but isn't there...) it only works if there is 1 file. Any more than one file and nothing is written to the log file so obviously multiple files cause the task to exit.

I'm using {TASK(PrevTask,Result.CopiedFilesDestination)} as the file path in the File Add/Edit condition window.

Any ideas on what GENERIC variable I can use to ensure that even multiple file downloads are logged?

Thanks
Judi




Support
2010-07-08T12:57:56Z
J Kruger wrote:

Hi ...

The solution above works just great 🙂 BUT (there's always a but isn't there...) it only works if there is 1 file. Any more than one file and nothing is written to the log file so obviously multiple files cause the task to exit.

I'm using {TASK(PrevTask,Result.CopiedFilesDestination)} as the file path in the File Add/Edit condition window.

Any ideas on what GENERIC variable I can use to ensure that even multiple file downloads are logged?

Thanks
Judi



Perhaps I am misunderstanding but you could check the downloaded files count. And only log if it is not 0.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
J Kruger
2010-07-12T10:21:56Z
Hi Henrik

How would I write that ... as a user variable? If so, could you point me to how I should write the code?

Thanks
Judi
Scroll to Top