K3 Documents

CSV over FTP Adaptor

Updated on

The CSV over FTP Adaptor allows a CSV received through FTP to be processed in K3.

Below you will find details on how to configure this adaptor. 

CSV over FTP Upload Adaptor

1. Select CSV as the K3 source

To receive a CSV over FTP, select CSV as the Source. Any other CSV related source type will not be able ot receive documents over FTP. Next, select the desired Target.

2.  Click Input URL

Add the URL and credentials necessary to receive the file, then click Test Connection. If the URL and credentials are correct, the window will display the directories at located at the provided URL. 

To enter a different URL or correct the credentials, click Edit Parameters.

3. Add custom parameters

To add custom parameters to the FTP request, click Show Advanced Configuration on the bottom left of the Input URL screen. This will display several predetermined parameters that may be edited, followed by Add Custom Param.


Clicking Add Custom Param will add two blank fields to the end of the parameter list. Enter the name of the parameter on the left hand blank, and the value of the parameter on the right.

Advanced Parameter Description
delay time (in milliseconds) the adaptor will wait before executing the next poll
move location where processed documents are moved to.
The default value (processed/${date:now:yyyyMMdd}/${file:name}) will place the processed documents in a folder based on the date and time the document was processed.
moveFailed location failed files are placed. The default value is "errors".
readLock prevents the FTP poll from consuming files that are currently being written. The default value, "changed", will only poll documents that have been modified since the last poll.

For advanced users, please see the camel file2 documentation for other options.
maxMessagesPerPoll maximum number of files the FTP will consume in a single poll. The default value is 20.
maximumReconnectAttempts amount of times K3 will attempt to reconnect to the source directory if disconnected. The default value is 3.
Custom Parameter Each FTP poll can be customized further. For advanced users, please see the camel file2 and FTP component documentation.

Parse CSV

1.Add sample data

Click Add Sample Data once the connection has been established.

2. Upload or paste sample data 

Sample data can be input by either uploading a file or pasting data into the box on the left.

3. Review uploaded data and determine separator

Once sample data is uploaded, K3 will attempt to determine the separator of your data. In the below picture, the right panel will shows how many fields were parsed for the following separators: comma (24 fields below) and tab (1 field below). K3 will highlight Configure Fields  for the separator it believes should be used based on the data provided. If your data uses a custom separator, such as a | , click the Custom Separator link to input the custom separator.


At this stage,  you can also tell K3 whether your data has headers by using the Header Row toggle at the top.


Click Configure Fields for the appropriate separator to move on to the next step.

4. Review fields names and field types

The Configure Fields step allows you to review the field names and field types that K3 has determined from your sample data. The first five rows of your data are shown to the right of each field to help guide you in making these decisions.


Note that K3 makes its best guess at the field types, so you might need to make some modifications based on your knowledge of the data.


The field name is only editable if you specified that your file does not contain a header row. 


Once you are satisfied, click OK in the bottom right to move on.

Configuration Parameter Description
Field Name This is the K3 field name corresponding to a column in your CSV. It will only be editable if you specify that your file does not contain a header. 
Field Type This is the K3 field type corresponding to a column in your CSV. K3 will recommend a field type, which you can modify.

5. Date Formats and Finalizing Configuration

The final step is to determine Date/DateTime formats, which K3 uses to parse strings representing Date/DateTime values. K3 will attempt to suggest formats that are appropriate for your data, but you might need to provide custom formats by clicking + Add below the Date/Date Time sections. Keep in mind that multiple formats are allowed and K3 will attempt to parse any value in the order that the formats are specified.


If you find that Date/DateTime field values are missing in Data Stream, you might need to return to this page to review the formats specified below. 

Configuration Field Value
Date Enter the format of Date fields in the CSV so that K3 can parse it properly.

Examples:
yyyy-MM-dd -> 1978-05-28
yyyyMMdd -> 19780528
MM/dd/yyy -> 05/28/1978
Date Time Enter the format of DateTime fields in the CSV so that K3 can parse it properly.

Examples:
yyyy-MM-dd'T'HH:mm:ss.SSSZ -> 1978-05-28T09:07:21.201-07:00
yyyy-MM-dd'T'HH:mm:ss.SSS -> 1978-05-28T09:07:21.201
yyyy-MM-dd'T'HH:mm:ssZ -> 1978-05-28T09:07:21-07:00

6. Save the route

Click Create on the top right side to save the route configuration.

7. Automatic source field import

Once you create the route, you will be navigated to the "Source Fields" dialog with your fields ready to be created. Click Save to create the fields.

8. Apply and Restart

Once you make a change to the route, whether it is adding fields or mappings, you must click Apply and Restart on the top right side of K3. This process tells K3 that you are ready to use the new data, mappings and rules. 

Previous Article HTTP Source Adaptor
Next Article Configuring the Scheduler