How to merge (join) multivalue element into one?

Dear Mergado,
is there any possibility how to merge multivalue (alternative_image) into ine element with certain separator?

Need to solve it because multivalue export to CSV adds automatically [ ] arount multivalue element and there is no possibility how to avoid it. I havent found solution :frowning:

Would you please help?

Thanks
Radim

1 Like

Dear Radim,

thank you for your question.
Unfortunately, merging a multivalue element (e.g. alternative_image) into a single field with a separator is a known limitation of Mergado — when you export a multivalue element to CSV, Mergado automatically adds square brackets [ ], and this behaviour cannot be disabled directly in the CSV export settings.
However, there are several ways to work around this. For example, you can create a new simple element and merge the values manually.

If you know how many alternative images you have (e.g. a maximum of 5–10), you can do the following:

  1. Create a new element (e.g. alternative_images_merged) on the Elements page.

  2. Create a Rewrite rule in which you write the values into the new element as follows:

%alternative_image {@@POSITION=1}%|%alternative_image {@@POSITION=2}%|%alternative_image {@@POSITION=3}% etc.

  1. You can choose any separator you like (|, ;, , etc.), however please make sure that the separator is not the same as the delimiter used in the CSV file.

The new element alternative_images_merged will be a simple (non-multivalue) element → it will be exported to CSV without square brackets.
You can hide the original IMGURL_ALTERNATIVE in the CSV feed (Elements → toggle Hide).

:warning: Disadvantage: the rule needs to be written for a specific maximum number of positions. Values where an image does not exist at a given position will simply be output as empty — this can be handled using a condition within the rule or an additional Find and Replace rule (e.g. removing || when a particular position is missing).

Should you have any further questions, please do not hesitate to contact our technical support team — we will be happy to help.

Kind regards
Tom

1 Like

Dear Tomáš,
Thank you for your useful advice. I did it this way and it works :+1:

Regard
Radim

1 Like