Transformation

XML or JSON

Uploading a ready to use document (i.e. XML or JSON) will not require any transformation.

The document will flow directly to the right API client and the communication with the government will start.

CSV standard formats

A-Cube Transfer provides, ready out-of-the-box, some document formats you can already use to map data to e-documents.

info

The CSV format allows to have at most 500 rows on a single CSV file.

This CSV standard mapping requires that all the values provided are ready for the final XML format.

  • Standard CSV format for electronic invoices in Italy download
  • Standard CSV format for electronic invoices in Poland download
  • Excel file explaining Standard CSV structure/fields for electronic invoices in Poland download

CSV custom mapping

The CSV custom mapping configuration is a process that is part of the customer on-boarding and is managed by A-Cube technical team in agreement with the customer IT department.

Configuration header

The CSV format is defined into the configuration header.

Copy
Copied
first-row-header: true
separator: ";"
enclosure: "\""
escape: "\\"

Field mapping configuration

One or more columns of the CSV file (input-field) are mapped to one document field (output-field). In case the input-field is a collection of columns then the result will be the concatenation of the CSV field contents.

It follows an example of a simple field mapping.

Copy
Copied
output-field: "Podmiot1.DaneIdentyfikacyjne.NIP"
input-fields: [ "Sender" ]

Default value mapping

In case the field is not available in the input CSV, you can define a default value.

Copy
Copied
output-field: "fatturaElettronicaHeader.datiTrasmissione.formatoTrasmissione"
default-value: "FPR12"

Conditional mapping configuration

It may happen that you want to map a particular field only if the input content meet certain requirements. This can be done at configuration time, it follows an example.

Copy
Copied
output-field: "natura"
input-fields: [ "Natura IVA" ]
conditions:
  - "row[18] == 0"

Transform mapping configuration

You may want to transform the input content before putting the content on the final output. You can apply many transformation functions to an input value. These functions are applied in cascade within the execution pipeline.

The supported transformation functions are:

  • expression Execute an expression using the current record. Example (get(row, 2) - get(row, 1) + get(row, 3))
  • formatDate Re-format a date given the initial date format and the final date format
  • formatString Apply a formatting rule to the value
  • map Get the result value based on a static mapping configuration. Example if in the CSV field the value is "A", then transform the value to "B"
  • substitute Transform the input value interpolating {column index} with values from the CSV. Example VAT NUMBER 01, where in CSV column 0 contains the country code and column 1 contains the VAT.
  • toUpper Transform the input to uppercase

It follows an example configuration.

Copy
Copied
output-field: "recipient"
input-fields: [ "Name", "Surname" ]
pipeline:
  - toUpper