An If Block defines a condition, and the set of actions to be performed if that condition is true. Any task element, except a schedule, can appear inside an If Block.
An If Block can be used within a File Loop when you want to test each file, for example, when the If Block is intended to act on source files. However, an If Block can be used to test more than just files; for instance, you can test the values of task parameters.
There are at least two elements required: the condition to be tested (for example "File Name matches *.txt") and the action to be taken if the file meets the condition. Actions include pulling files from a specified source, pushing files to a specified destination, or running a process.
An If block can be configured anywhere within an Advanced Task.
When adding an If Block, there are two settings to configure:
Filters - When you add an If block, the Edit If Branch dialog opens. Within this dialog you can build a filter to select the files or parameters that you want to test. See the section below for more information on using filters. Note that you can use up to 6 filters.
Actions - the action (destination, process, email, etc) you want to take when the condition specified in the filter is true.
Within an If Block, you can do further conditional processing by using these two elements:
Else If Branch - This element lets you set a different test of a condition, followed by a different action for the files that do not meet the condition specified in the initial If element.
Else Branch - This element lets you set a different action (destination, process, email, etc) for those files that do not meet the condition specified in the If element.
Using Filters
Note:You can use up to 6 filters. A "match all/any" selection controls whether files must match all or just one of the filter criteria.
File Name - When "matches" is selected, specifies the file name (i.e. "readme.txt") or file mask (i.e. "*.txt") MOVEit Automation should use to select files on the remote host. You may use Macros in this field. When "does not match" is selected, MOVEit Automation selects the files that do not match the file name or file mask.
Note: You cannot use the "=" operator to match file names (string values). You must use "matches" or "does not match."
There are two special wildcard characters:
*, which matches zero or more characters at that position in the filename
?, which matches exactly one character at that position in the filename
You may use multiple wildcard characters in a single mask.
For example, a*.rpt matches a.rpt, a1.rpt, and apple.rpt, but not apple.rp or lemon.rpt. a?.rpt matches a1.rpt and aQ.rpt, but not a.rpt, a12.rpt, or a1.rp
You may also use multiple filenames or filemasks, separated by semi-colons (";"). The semi-colons act as an "Or" operator. For instance, the filemask "fred*.*;*.zip" will match fred7.txt and will also match sally.zip.
File Size - Select files based on their size. Supported size filters are expressed in your choice of bytes, KB, MB or GB. A "match all/any" selection controls whether files must match all or just one of the filter criteria.
File Modified Timestamp - Select files based on their date/time of last modification. Supported date/time filters are expressed the difference between now and some other date in hours, days, months or years.
Task Error Code - Test the value of an error code returned from the task.
Custom macro - Select any MOVEit Automation macros, or custom macros you have created. For example, to take action based on the value returned from a previous Look Up process, enter "[Parm:Lookup_Value]".