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.


Au Ma
  •  Au Ma
  • Paid support Topic Starter
2021-09-21T01:19:25Z
Hello,

I'm looking to set up a job list files from an SFTP and download them if a file exists. If there are no files found, then the job will stop there.

I stumbled upon this old forum post from 5 years ago where the poster has the same exact requirement as I do.
Stop Job When List Files Returns Zero 

Is anyone able to look at the task conditions that I've created and let me know what needs to be changed?
They are not working and my job continues to fail whenever a file is not detected on the SFTP.

image.png

Thank you.
Sponsor
Forum information
Joey S
2021-09-21T14:34:41Z
You have an easy way and a slightly complicated way you can do that

When the first task goes to list the files and none are found, it should by default error out. The default error codes should be like this:


So, if there are no files the first task will fail. Using this failure allows you stop the job right there with standard flows

This will, however, create a failure every time and, if you are like me, you will want to avoid failures.

So option 2 would be similar to what you are doing but instead of using the Flow you will use a condition. You may very well be able to do it the way you show but I am more familiar with the condition sets and the nice thing is they are "re-usable". Meaning, you can use them for multiple jobs.

So, keep your task #1 the way it is and set your flows back to Default. Also, make sure you uncheck the File Not Found in the Error Section so any situation where files are not found will not be considered an error. Change from this:
image.png
to this:
image.png

Task #2 will have a condition enabled to accomplish your goal.

Create a new condition by following the steps below
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png - notice how the box is blank. Do not type anything in. The "No Output" you see when the job runs is just for you and not actual words so this box is blank.
Then OK all the way out but make sure you check mark the Condition you set.
image.png

Your job should look like this
image.png
Au Ma
  •  Au Ma
  • Paid support Topic Starter
2021-09-21T21:56:30Z
Originally Posted by: Joey S 

You have an easy way and a slightly complicated way you can do that

When the first task goes to list the files and none are found, it should by default error out. The default error codes should be like this:


So, if there are no files the first task will fail. Using this failure allows you stop the job right there with standard flows

This will, however, create a failure every time and, if you are like me, you will want to avoid failures.

So option 2 would be similar to what you are doing but instead of using the Flow you will use a condition. You may very well be able to do it the way you show but I am more familiar with the condition sets and the nice thing is they are "re-usable". Meaning, you can use them for multiple jobs.

So, keep your task #1 the way it is and set your flows back to Default. Also, make sure you uncheck the File Not Found in the Error Section so any situation where files are not found will not be considered an error. Change from this:
image.png
to this:
image.png

Task #2 will have a condition enabled to accomplish your goal.

Create a new condition by following the steps below
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png - notice how the box is blank. Do not type anything in. The "No Output" you see when the job runs is just for you and not actual words so this box is blank.
Then OK all the way out but make sure you check mark the Condition you set.
image.png

Your job should look like this
image.png




Thanks for taking the time to reply.
I've set up the condition and have it checked off in my 2nd task (download file).
My list file task does not error out my job anymore but now my 2nd task is not downloading the file from the SFTP. The task works when I uncheck the condition though.


Joey S
2021-09-22T14:02:40Z
My fault

Change your condition to this

image.png
Support
2021-10-12T18:27:06Z
Thanks a lot Joey.

I assume that sorted your problem?
Michael
Support
http://www.visualcron.com 

Please like  VisualCron on facebook!
Scroll to Top