BS Attribute Converter

Contentserv allows switching attribute types at any time. However, this modifies only the attribute definition, not the data itself.

When you switch from a numeric field to a single-line text field, this is not a problem. But when you switch for example from a single-line text field to a value range selection field, things become complicated, as the data stored in the database are afterward only the value range ID values, while the text of the values would be within the value range definitions.

To allow the runtime conversion along with data modification the BS Attribute Converter is available, currently under the BS Labs license along with the BS Skills package.

Once the BS Labs license is activated you will find a new toolbar button in the PIM attribute editor:

In the screenshot above there is a single-line text field “Publisher”, which could be converted for example to a selection field. Click on the “Convert Attribute” button to launch the conversion wizard:

The first time the dialog is displayed, it shows a warning, that such transformations might not be reversible and could lead to data loss. Please create a backup before continuing here and then activate the “Read it and got it” button to proceed.

The wizard allows to select various typical target formats:

To convert the “Publisher” attribute to a simple selection field choose “Simple Selection”:

Helpful is especially the “Clean existing values” list, which automatically lists all possible values available at this time. You can review the default replacements and update replacements when required. The value for Hannibal seems to show up twice with slight differences. It can be corrected here and merged to simply “Hannibal”:

To start the conversion press the play button. The conversion process is based on the well known Active Scripts engine:

When done close the dialog and reload the attribute editor to see the effect:

Also, the data in the PIM products were automatically adapted as required:

Conversion rules

When converting data the following mechanisms are applied:

  • Single-line Text => Value Range: Values are created and the text in the fields replaced by the IDs to refer to the new values

  • Single-line Text => Number: Values are converted to numbers as good as possible

  • Single-line Text => Number Range: Values are split into two parts when a dash is contained

  • Value-Range => Text: Value IDs are replaced by the values