Field assignments | Create OCI and cXML PunchOut Catalogues | PunchCommerce                           ![](//analytics.punchcommerce.de/matomo.php?idsite=1&rec=1)

Field assignments
=================

You can use the "Field assignments" menu item to create an individual assignment between the fields defined in your customer's protocol and the fields available in our system.

On the left-hand side of the mapping tool, select the target field of the desired protocol (e.g. OCI), then select the desired mapping type (database, fixed value, dynamic (only for gateway mode).

On the right-hand side, select the source field and/or the value to be assigned to the respective protocol field.

**Database**: In the "Source field" field, select a field from our data model that is to be used as the data source for the selected target field during transmission.

**Fixed value**: In the "Source field" field, enter a fixed value that is to be output in the selected target field during transmission to the calling ERP system.

**Dynamic**: This assignment type is only available for the Gateway mode. Here it is possible to transfer and assign further data in the "product" object during the retransfer from the called shop system.

```
...
    "additionalProp1": [
          {
            "label": "string",
            "value": "string"
          },
          {
            "label": "string",
            "value": "string"
          }
    ],
...
```

**Example**: In the "product" object, you also transfer the "classifications" array, which in turn contains objects with the keys *label* and *value*. Here you have the option of storing the key description *classifications* in the first input field and the value of the key *label* in the second. The *value* field of the same object is now used for the field assignment.

Customer and shopping basket values
-----------------------------------

Depending on whether the field mapping is created for OCI or cXML, further values are available.

### cXML

The following additional values from the customer setting are available for cXML:

- Buyer Identity
- Supplier Identity

### OCI

There are no specific values available for OCI

### All protocols

Regardless of the protocol, the following values are available from the shopping basket item:

- Product name
- Product number
- Product quantity
- Unit price
- Gross price
- Net price
- Tax rate
- Item category

What are field transformations?
-------------------------------

Field transformations allow you to dynamically change values in your field mappings before they are transferred to the target system. You can use transformations to convert input values into other values based on defined rules.

Access to field transformations
-------------------------------

1. navigate to **Field mappings** in the main menu.
2. select an existing field mapping or create a new one.
3. in the detailed view of the field mapping, you will see a list of all mapped fields.
4. next to each field is a green button labelled **"Transformation(s) "**.

Creating and editing transformations
------------------------------------

To create or edit a transformation for a field:

1. click on the green **"Transformations "** button next to the desired field.
2. a page area opens with the transformation settings.
3. if no transformation exists yet, an empty assignment is automatically created.

Configuration of a transformation
---------------------------------

### Type of transformation

Two transformation types are currently supported:

1. **"Replace value "** (If transformation): This transformation checks whether the input value matches a defined value and replaces it with another value if necessary.
2. **"Append To "** (AppendTo transformation): This transformation allows you to append a fixed text or the content of another product field to the value of the current field.

### Configuration of the "Replace value" transformation

#### Add mappings

1. enter the value to be replaced in the **"Input value "** field.
2. in the **"Replace with "** field, enter the target value that is to be used instead.
3. click on **"Add further assignment "** to define further replacement rules.

### Configuration of the "Append To" transformation

You have two options for the "Append To" transformation:

1. **Append fixed value**: Select this option to append a static text to the field value.

    - Enter the text to be appended in the **"Fixed value to append "** field.
2. append **value of another field**: Select this option to append the value of another product field.

    - In the drop-down menu **"Field to append "**, select the product field whose value is to be appended.

Saving or deleting transformations
----------------------------------

- Click on **"Save "** to save the transformation.
- Click on **"Delete "** to remove the transformation.

Application examples
--------------------

### Example 1: Convert status values (replace value)

If your source system uses status values such as "0" and "1", but the target system expects "Inactive" and "Active":

1. create a "Replace value" transformation with the following assignments:
    - Input value: "0" → Replace with: "Inactive"
    - Input value: "1" → Replace with: "Active"

### Example 2: Adapt language codes (replace value)

If your source system uses language codes in "de-DE" format, but the target system only expects "de":

1. create a "Replace value" transformation with the following mappings:
    - Input value: "de-DE" → Replace with: "de"
    - Input value: "en-US" → Replace with: "en"

### Example 3: Set default values (replace value)

If you want to ensure that empty values are replaced by a default value:

1. create a "Replace value" transformation with the following assignment:
    - Input value: "" → Replace with: "Default"
2. deactivate "Use payload as fallback" and set the fallback value to "Default".

### Example 4: Add units (Attach To)

If you want to append units of measurement to numerical values:

1. create an "Append To" transformation.
2. select "Append fixed value".
3. enter "kg" as the fixed value to be appended.
4. the result would be e.g. "5" → "5 kg".

### Example 5: Combine article number with description (append to)

If you want to combine the article number with the article description:

1. create an "Append To" transformation for the "products.ordernumber" field.
2. select "Append value of another field".
3. select "products.title" as the field to be appended.
4. the result would be e.g. "A12345" + "Screwdriver" → "A12345 Screwdriver".

Hints
-----

- You can define multiple transformations for a field.
- The number of active transformations is displayed below the field in the field mapping view.
- Transformations are applied in the order in which they were defined.
- Make sure that all input values and replacement values are defined correctly to avoid unexpected results.
- With the "Append To" transformation, the values are appended without additional formatting. If necessary, insert spaces or other separators in the text to be appended.

 [ PunchCommerce® ist ein Produkt der ![Netzdirektion GmbH](https://www.punchcommerce.de/static/netzdirektion-logo.png "PunchCommerce® ist ein Produkt der netzdirektion | Gesellschaft für digitale Wertarbeit mbH") ](https://netzdirektion.de)

 [Give feedback now - your opinion helps us to become even better!](https://easy-feedback.de/umfrage/1883200/5FuM95 "Your opinion helps us to become even better!")
