# FTP

## Functions

The following list of functions are available in the FTP system:

### getFiles

### postFiles

{% hint style="warning" %}
Functions lists are expanding weekly, this list was accurate at the date of publishing.
{% endhint %}

## Settings

The following settings below are optional for FTP type integrations.

### array\_key

tbc.

### array\_merging

Used when combining multiple events together in the destination functions. This settings allows the specification of a top level key that will be merged together.&#x20;

* **Type**: Text
* **Required**: No
* **Default**: N/A

**Applicable functions:**

* PostFiles

**Example:**

```yaml
array_merging = "products"
```

### edi\_format

edi\_line\_identifier

edi\_group\_terminator

edi\_force\_multiples

edi\_multi\_line

### event\_grouping

tbc

### file\_far

Ability to find and replace in a file after its generation. This feature can be helpful if the use of protected key names is required.

* **Type**: Text
* **Required**: No
* **Default**: N/A

**Applicable functions:**

* PostFiles

**Example:**

```yaml
file_far = "find_first|replace_first,find_second|replace_second"
```

### filename\_format

Defines the output file naming convention

* **Type**: Text
* **Required**: No
* **Default**: ##DATETIME##.##EXTENSION##

**Applicable functions:**

* PostFiles

**Example:**

```yaml
filename_format = "Payout_Report_##DATETIME##.xml"
```

**Dynamic field values:**

| Setting                       | Output                                                                                                                                                                                                                                                                                                       | Example                              |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------ |
| ##JOBID##                     | Injects the current job id used in the data stream by HighCohesion.                                                                                                                                                                                                                                          | 1b503450-89ea-11ea-903e-6ef3fac04b7e |
| ##DATETIME##                  | Injects the current date and time in the format: YYYY-MM-DD-HH-mm-SS                                                                                                                                                                                                                                         | 2020-06-01-11-00-00                  |
| ##DATETIMEEXACT##             | Injects the current date and time with milliseconds in the format: YYYY-MM-DD-HH-mm-SS-zzz                                                                                                                                                                                                                   | 2020-06-01-11-00-00-000              |
| ##DATETIMEFORMAT\_\_XXX\_\_## | <p>Inject a custom date time format. Where **XXX** is replaced with the required formatting. Example being: ##DATETIMEFORMAT\_\_Ymd\_\_##</p><p></p><p>See: <a href="https://www.php.net/manual/en/function.date.php"><https://www.php.net/manual/en/function.date.php></a> for PHP formatting examples.</p> | 20200601                             |
| ##TIMESTAMP##                 | Injects the current Unix timestamp.                                                                                                                                                                                                                                                                          | 1588149986                           |
| ##EXTENSION##                 | Injects the extension as per the [formatting](https://docs.highcohesion.com/creating-streams/systems/system-library/broken-reference) setting.                                                                                                                                                               | xml                                  |
| ##INCREMENT##                 | Injects an incremented number based on the stream ID. Checks the HighCohesion internal increment pointer for the stream in use. Each time that the stream is triggered the pointer will increment by one.                                                                                                    | 42                                   |
| ##PK\_\_XXX\_\_##             | Injects the value of a specified payload key where XXX is replaced with a payload key. For example ##PK\_\_order\_number\_\_##                                                                                                                                                                               | GB101231                             |

### formatting

Defines the input or output file formatting.

* **Type**: List
* **Required**: No
* **Default**: xml

**Applicable functions:**

* GetFiles
* PostFiles

**Example:**

```yaml
formatting = "csv"
```

**List values:**

| Setting | Output              |
| ------- | ------------------- |
| xml     | XML file formatter  |
| json    | JSON file formatter |
| csv     | CSV file formatter  |
| xls     | XLS file formatter  |

### group\_on

Allows the grouping of lines from an input file based on a specific column.

* **Type**: Text
* **Required**: No
* **Default**: N/A
* **Relative to**: CSV and XLS file imports.

**Applicable functions:**

* GetFiles

**Example:**\
The example below would group lines of a CSV file together based on the order\_number column. The is helpful when receiving CSV files from systems such as warehouse management systems that can send multiple lines in one file.

```yaml
group_on = "order_number"
```

### increment\_in\_file

Ability to inject the data stream increment reference into the payload\_out data, before file generation. For example if the destination needs unique file number reference in the file. The value should be the path to add the increment to in the output data.&#x20;

* **Type**: Text
* **Required**: No
* **Default**: false

**Applicable functions:**

* PostFiles

**Example:**

```yaml
increment_in_file = "header.reference.number"
```

### index\_array

Allows the breaking up in to individual events based on a key that should be present in the input file data.

* **Type**: Text
* **Required**: No
* **Default**: N/A
* **Relative to**: XML file imports.

**Applicable functions:**

* GetFiles

**Example:**\
...

```yaml
index_array = "Products"
```

### line\_index\_array

### remote\_path

Allows definition of the remote path. Use this setting to instruct the data stream where to look for files on the remote location.

* **Type**: Text
* **Required**: No
* **Default**: /

**Applicable functions:**

* GetFiles
* PostFiles

**Example:**

```yaml
remote_path = "/orders/uk_website/"
```

### root\_element

Allows the specification of the root XML element.&#x20;

* **Type**: Text
* **Required**: No
* **Default**: data
* **Relative to**: XML file exports.

**Applicable functions:**

* PostFiles

**Example:**

```yaml
root_element = "Orders"
```

### skip\_incrementer

tbc.

### skip\_path\_check

Defines if the system should skip the remote path check. This is especially helpful for some sFTP destinations where the remote list functionality is not available.&#x20;

* **Type**: Boolean
* **Required**: No
* **Default**: false

**Applicable functions:**

* PostFiles

**Example:**

```yaml
skip_path_check = true
```
