Import complex attributes as JSON strings

Using a simple example, this chapter explains how to import “Complex” type attributes as JSON strings in a .xlsx file.

Note
This chapter is limited to an explaination of how complex attributes are imported in the form of JSON strings, where the complex attribute is added to an existing catalog. In order to find an example for the whole catalog process of a supplier catalog, click here.
INFO
In this example, two rows of values for the complex attribute “Toastgrade suggestion (TS704)” are imported, whereby the values are assigned to the related attributes “Toast slice number (TSN704)” and “Suggested roast stage (TSN704)”.
FAQ

Is it possible to delete values of a complex attribute via an import?
In order to delete the values of a complex attribute, you need to import an empty array for the respective attribute.

Create the JSON string

In this step, the JSON string is created.

Template for a JSON string

A template for a simple JSON string looks like the following:

[
  {
    "identifier": "attribute identifier",
    "attributeDataType": "attribute type",
    "values": [
      {
        "value":"attribute value"*
      }
    ],
    "position": "/row number/column number",
    "type": "attribute"
  }
]
INFO
*Depending on the attribute type and other attribute properties, the following additional parameters can be relevant: „uom“: null, „level“: null, „amount“: null, „sortIdx“: null, „descriptions“: null, „asset“: null, „plain“: null, „client“: null, „inherited“: null, „valueFrom“: null, „valueTo“: null, „pimRef“: null, „version“: null, „contentObjects“: null, „inactive“: null, „lang“: null, „refType“: null, „isFromParent“: null, „inheritedFromPimRef“: null

Formatted JSON string for the example

The complete, formatted JSON string for the example mentioned above looks like the following:

[
  {
    "identifier": "TSN704",
    "attributeDataType": "NUMBER",
    "values": [
      {
        "value":"1"
      }
    ],
    "position": "/1/1",
    "type": "attribute"
  },
  {
    "identifier": "SRS704",
    "attributeDataType": "NUMBER",
    "values": [
      {
        "value":"3"
      }
    ],
    "position": "/1/2",
    "type": "attribute"
  }
],

[
  {
    "identifier": "TSN704",
    "attributeDataType": "NUMBER",
    "values": [
      {
        "value":"2"
      }
    ],
    "position": "/2/1",
    "type": "attribute"
  },
  {
    "identifier": "SRS704",
    "attributeDataType": "NUMBER",
    "values": [
      {
        "value":"5"
      }
    ],
    "position": "/2/2",
    "type": "attribute"
  }
]

Reference Attribut type
ASSET Digital asset
BOOLEAN Logical value
CMYK Character string, CMYK
COMPLEX Complex
DATE Date
DATEANDTIME Date and time
DECIMAL Number, decimal
DECIMAL_RANGE Number, decimal
HEXADECIMAL Character string, HEX
LOCALE language
LOOKUP List of values, single
MAINTENANCE_LEVEL Maintenance level
META Meta attribute
MULTI_LOOKUP List of values, multiple
NUMBER Number, integer
NUMBER_RANGE Number range, integer
PERCENTAGE Number, percentage
PLAIN_STRING Character string, not localized
STRING Character string, localized
COMPOSITION Composition, listed

Unformatted JSON string

For the imported, the JSON string needs to be turned into an unformatted string that has no line breaks or tabs which looks like the following:

[{"identifier": "TSN704", "attributeDataType": "NUMBER", "values": [{"value":"1"}], "position": "/1/1", "type": "attribute" },{"identifier": "SRS704","attributeDataType": "NUMBER","values": [{"value":"3"}],"position": "/1/2", "type": "attribute"},{"identifier": "TSN704", "attributeDataType": "NUMBER", "values": [{"value":"2"}], "position": "/2/1", "type": "attribute" },{"identifier": "SRS704","attributeDataType": "NUMBER","values": [{"value":"5"}],"position": "/2/2", "type": "attribute"}]

Insert the JSON string into the catalog file

In this step, the JSON string is pasted into the appropriate cell of the catalog file. To do so, proceed as follows:

  1. Copy the JSON string to the clipboard.
  2. Open the catalog file in a spreadsheet software.
  3. Paste the JSON string into the appropriate table cell.
  4. Save the file.

In this example the supplier attribute “Suggestion” that contains the JSON string is mapped to the iPIM Supply attribute “Toastgrade suggestion (TS704)”.

Import the file and create the mapping

In this step, the corresponding attribute mapping is added to the existing catalog. To do so, proceed as follows:

  1. Call up the catalog, set the import mode to “Assortment update” and import the catalog as, for example, described here.
  2. Call up the transformation configuration and go to the “Transformation rules” area.
  1. Click on the Add button to call up the corresponding dialog box.
  1. From the left-hand menu, select the appropriate iPIM Supply attribute (in this example “Toastgrade suggestion (TS704)”).
  2. From the right-hand menu, select the supplier attribute (in this example “Suggestion”).
  3. Click on the Save button to finalise the creation of the mapping. Following this, the dialog box closes and a new mapping entry appears in the table.

The mapping of the complex attribute is now complete and after carrying out the transformation you can proceed to the catalog process steps “Approval” and “Synchronisation”. Once the synchronisation is completed successfully, the values of the complex attribute can be viewed in the iPIM Portal. The number of rows is shown next to the Puzzle piece icon, whereas the values can be seen in the mouseover window.