I am setting up a flow which starts with an SFTP task.
START -> FTPJob -> Job1 -> Job2 -> END
Some days, there will not be a file to pick up. How would I then skip the remaining jobs in the flow?
Someone might have a better solution, but I like to add another job in front of FTPJob. This additional job just returns a list of files on the FTP site, and in a post-process script it checks to see if the file exists on the report with a PREP_PROCESS_REPORT() function. If it finds that a file exists then it can put the file name in a static VAR object. Otherwise it populates the static VAR object with a key word like "NOFILE". Then the rest of the steps check this static VAR object for the value "NOFILE" in their workflow preconditions.
This method works great for systems where you don't know the exact file name. (Quite often the file name can have a timestamp in it.) Once the file name is in the static VAR it can be used with "generate at runtime" for many other purposes later in the workflow.
We have an Include object that we insert in the FT's Process tab to check the existence of the source file. It uses the GET_ATT for FT_SRC_HOST and FT_SRC_FILE and then performs a PREP_PROCESS_FILENAME to determine if the file exists. If it does, no action is taken.
If the file does not exist then a STOP NOMSG is executed and subsequent tasks check the FT's status as appropriate.
We also have common logic that determines information about the source file to handle getting, for example, the latest timestamped or generation. However, as a matter of convention, the Source file is usually a "simple" file name that is a copy of the actual file and it is deleted at successful transfer. This helps avoid lots of issues of getting an incorrect, duplicate or incomplete file.
Retrieving data ...