The following outline illustrates one way you can use the FTP Connector to read and parse content from a delimited file that resides on a remote FTP server. The content is added to a process object so you can use the data to make a service call and iterate through a list of records.
First, configure the Connection:
1Define the basic connection properties and select FTP as the Connection Type. Be sure to select an agent where the connection will run.
2In the FTP Connection Properties, enter or select the necessary details for the FTP connection. The required properties depend on the remote FTP server but these options are the minimum required:
4Enter a name for this event source and enable it so the connection to be available as soon as you publish it. If you do not want the connection to be immediately available, you can disable it now but must enable it before you can run the process successfully.
5Specify the directory that should be monitored on the FTP server, where delimited files can be accessed. This field is required. You can specify other optional properties to exclude or include specific files or the subdirectories.
6Enter other file parsing options as needed.
7Select No for Use Built-In Process Objects and, for Custom Object, enter a comma-delimited list of header names that are exactly the same as the names of the headers in the delimited file header you are reading. For example:
Name,Street,City,State,PostalCode,Country,Phone
8Select any optional File Read Lock Settings you want to use.
9Save, test, and publish the process.
Second, create the Process:
1Create a process and be sure it runs on the same Secure Agent defined in the connection.
2On the Start tab, select the connection, DelimitedContent, to automatically make the input field available that will hold the file content when the connection detects a new file in the monitored directory.
3Create two temporary variables in the process properties so you can iterate through the delimited content in the file:
aOne to hold the full set of records. For example, TempIterator.
bOne to hold each object as you iterate through the file. For example, TempCurrent.
4Create an Assignment step to assign the file records (process objects list) to the TempIterator field.
5Create an Assignment step to populate the current record from the list into a temporary variable, TempCurrent. Specify Formula as the source of TempCurrent, and use the following to get the first record:
list:head($temp.TempIterator)
6Add a Decision step to validate that the record is set.
7In the Is set branch, perform the functions you need to process the data. For example, you might make a service call to an external service like RequestBin and pass in each record read from the file, so the service can generate a list of data.
8Add an Assignment step to remove the processed record from the list of process objects. Specify Formula as the source of TempIterator, and use the following:
list:remove($temp.TempIterator,1)
9Add a Jump step to loop back to the Assignment step that populates TempCurrent and get the next record from the process object.
10In the Is unset branch, you can make another service call or take some other action. In this example, the Is unset branch calls reads the FileInfo from the process object and calls a service to publish the record count to the client.