Previous Topic

Next Topic

Book Contents

Book Index

If Block

The following example shows how an Advanced Task can be used to process and route source files based on file extension.

In this example, the goal is to archive and secure records of customer transactions for a financial company. Multiple branch offices record the transactions and send them to a central host, which is remote to the MOVEit Automation host. Two types of files (.pgp, .txt) are placed on the remote host.

We will create an Advanced Task that pulls files from the TransactionsA folder on remote Host A, and based on the file extension, pushes the file to the appropriate host. The .pgp files go to the TransactionsB folder on Host B and the .txt files go to the TransactionsC folder on your localhost (Host C).

  1. In the Tasks tab, click Add Task. The Add New Task dialog opens.

  2. In the New Name box, enter a descriptive name for the task: "Route files from Host A based on extension."
  3. For Task Type, select Advanced.
  4. Click OK.

    The task is added to the list of tasks. This task is marked with a red X to indicate that it cannot yet be run. This differs from a Traditional Task in that we do not complete a wizard before the task is added to the task list. We will right-click on the task name to select the task elements to be added to this task.

  5. Right-click the task, and select Add source. The Define New Source dialog opens.
    1. In the Define New Source dialog, select Download from FTP server, then select Host A, then click OK. The FTP Source - Host A dialog opens.
    2. Browse for and select the TransactionsA folder. This is the folder that holds the customer transactions (.pgp and .txt files). We want to select all files in this folder, so we'll keep the default File(s) selection (*.*), then click OK. The source is now added to the task.

    When you add a source to an Advanced Task, MOVEit Automation displays a message asking whether you want to add a File Loop. In most cases, you will want to use a File Loop so you can apply elements to all files in the source list.

  6. Click Yes to add a File Loop. (If the message does not appear, then right-click on the source definition and select Add File Loop.) The File Loop is added to the task. The "For each file ..." statement indicates for each file downloaded from the source, any task element that we put in this file loop will be run on that file. We use the loop so that we can run the If block against all the source files.

  7. Right-click the File Loop (For each file...) and select Add If block. The Edit If Branch dialog opens. First, we will look for all files with the .pgp extension. Select the following parameters:

    Match all File Name matches *.pgp

    The If Block is added to the task, below the source definition.

  8. Right-click the If Block and select Add Destination. The Define New Destination dialog opens.
    1. In the Define New Destination dialog, select Upload into FTP server, then select Host B, then click OK. The FTP Destination - Host B dialog opens.
    2. Browse for and select the TransactionsB folder. This is the destination for the .pgp files. The destination is now added to the task.

  9. Right-click the If Block and select Add Else If Branch. The Edit If Branch dialog opens. We now look for all files with the .txt extension. Select the following parameters:

    The Else If Block is added to the task, below the destination definition.

  10. Right-click the Else If block and select Add Destination. The Define New Destination dialog opens.
    1. In the Define New Destination dialog, select Add to local folder, then click OK. The Edit Local Folder Destination dialog opens.
    2. Browse for and select the TransactionsC folder. This is the destination for the .txt files. The destination is now added to the task.

We now have the completed task. When run, this task will filter the folder on Host A and send any .pgp files to Host B, and any .txt files to Host B.

You can add a schedule, or other sources, destinations, file loops, if blocks, or emails.