A variable of type list (List variable) and separation into multiple elements

E.g. <IMAGES> img1, img2, img3 </IMAGES> change to <IMG_ALTERNATIVE> img1 </IMG_ALTERNATIVE> <IMG_ALTERNATIVE> img2 </IMG_ALTERNATIVE>

Do you need to split the values ​​given in one element into more elements?

For example, you have in XML image1, image2, image3 and you need to have the listed images in a separate element on the output, e.g.

<IMG_ALTERNATIVE> fig1 </IMG_ALTERNATIVE>

<IMG_ALTERNATIVE> fig2 </IMG_ALTERNATIVE>

If you are importing data in a custom format, you can set Custom on the import

After importing, go to Edit import in the left menu and click on the New variable button

Select List Variable here

Name the new variable and select the original variable, which is of the list type, as the content. It is also necessary to add a delimiter (in the preview on the right you can see whether the delimiter in the XML is a comma, semicolon or space.

To create a variable, click on the "Create variable" button. We will now use the new variable in the export to create new elements. First, go to Export and Edit Products in the left menu and click Edit

Click on Rules and then Add New Rule, select Add Element

Insert into the content of the element: {{image in% images%}} <IMG_ALTERNATIVE> {{image}} </IMG_ALTERNATIVE> {{end}} To complete the variable (images in this example), use% (the variable whisper will be displayed.

In the right part of the screen you can see how the newly created element is written to XML.

Newly created elements are overwritten in the following form:

<IMG_ALTERNATIVE>https://product-imacccc.com/043/002243.jpg</IMG_ALTERNATIVE>
<IMG_ALTERNATIVE>https://product-imacccc.com/0043/222te.jpg</IMG_ALTERNATIVE>

Click on the Create rule button to save everything.

Last updated