X4 Produktdokumentation

Defining the Technical Process: CSV Converter

In this step, you define the first process steps of the Technical Process. The CSV file prepared for this example should be imported into the system and transformed into an XML format for display in the Web App.

Use the CSV Converter adapter for this purpose. This adapter reads a CSV text document from the previous process step and outputs an XML document in UTF-8 character encoding for the specified data sets, which can then be cached for further processing.

◀️

Prerequisites:

You have created the example CSV file that was to be prepared and saved it locally. For more information, see Example: Web App Project.

Importing a resource

  1. Right-click the Services > Resources folder in the project structure.

  2. Click Import….
    The Resource Import Wizard dialog opens.

  3. Click on Browse… and select the desired file on your computer.
    ✅ The imported file appears in the Resources folder.

Inseringt an example file into the process

  1. Drag the imported file from the Projects view next to the image-20241009-135007.png Start element in the editor.

  2. Click on the lower right image-20241015-085229.png corner of the image-20241009-135007.png Start element, hold down the mouse button, and drag a connection to the image-20241029-085012.png customers element.

    image-20241029-085406.png

Creating and configuring the adapter

  1. Right-click the Services > Adapters folder in the Projects view and select New > Adapter….
    The File Creation Wizard dialog opens.

  2. Enter the value CSV in the search field and select the CSV Converter.
    If necessary, you can customize the name of the adapter in the File name field.

    image-20241029-085726.png
  3. Click Finish.
    ✅ The adapter is created in the Adapters folder and opens automatically in the editor.

  4. For the purposes of this example, you only need to adjust two values of the adapter's parameters:

    image-20241029-092153.png
    1. Select the checkbox of the columnNamesInFirstRow parameter so that the data fields of the first line in the CSV text file are interpreted as column labels and the data field elements in the XML document are named accordingly.

    2. Since the values in the example file you are using are separated by commas, enter the value , in the delimiter field.

  5. Click image-20241009-130249.png Save.

  6. Return to the Technical Process ProcessWebApp.wrf.

Inserting the adapter

  1. Drag the image-20241016-105227.png Adapter element from the Palette view next to the image-20241009-135007.png Start element in the editor.

  2. Double-click the image-20241016-105227.png Adapter element.
    The Choose Adapter File dialog opens.

  3. Select the adapter that was previously created in the Adapters folder.

  4. Click OK.

  5. Select the Parse value in the Operation field in the Properties of the adapter so that the document is read in one step.

  6. Click on the lower right image-20241015-085229.png corner of the image-20241029-085012.png customers element, hold down the mouse button, and drag a connection to the image-20241029-092602.png CSV_Converter element.

    image-20241029-093121.png
▶️