How to Combine Two Arrays in a Specific Order?

Hello everyone!

I’m working with two arrays - Array A and Array B - each containing 50 elements. My goal is to create a string that combines the values from both arrays in this specific order: [ValueA1][ValueB1][ValueA2][ValueB2]… continuing this pattern until all pairs are included.

Do you have any suggestions on how to achieve this effectively? I’d really appreciate any tips or insights.

Thank you so much for your help!

Can you please provide the output bundles of both modules/arrays?

This will help us provide an example.

Please provide the output bundles of the modules by running the scenario (or get from the scenario History tab), then click the white speech bubble on the top-right of each module and select “Download input/output bundles”.

A. Upload as Text File

Save each bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.

B. Insert as Formatted Code Block

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles.
These are the two ways to format text so that it won’t be modified by the forum:

  • Method 1: Type code block manually

    Add three backticks ``` before and after the content/bundle, like this:

    ```
    content goes here
    ```

  • Method 2. Highlight and click the format button in the editor

Providing the input/output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.

This will allow others to better assist you. Thanks!

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.

Thank you for your willingness to help, I truly appreciate it.

Here are the files:
TextValue.txt (3.1 KB)
TagsValue.txt (3.1 KB)

My goal is to combine the values from these files in the following format:

[TagsValue[1]][TextValue[1]][TagsValue[2]][TextValue[2]][TagsValue[3]][TextValue[3]]...

While my previous example mentioned 50 elements, this was just for illustration. The actual number of elements will vary depending on the HTML file I’m working on.

Alternatively, if you have any question how to deal with such problem, I am welcoming any tips that you may have to do it more effectively.
I’ve also included a blueprint file to provide more context about my current approach. (I still need to work on the regex paterns, the ones I have set are not working properly just yet).

blueprint.json (45.9 KB)

If you have any suggestions on how to tackle this problem more efficiently, I would love to hear them.

Thank you so much for your help!

1 Like

Also, in case you would find useful to know the initial html that I work with (that I try to translate) here I attach the full file:
html.txt (2.3 KB)

Thank you for any help!

Welcome to the Make community!

Yes, that is possible. You’ll need a minimum of two modules:

This is just an example. Your final solution may or may not look like this depending on your requirements.

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.

1 Like

Module Export - quick import into your scenario

You can copy and paste this module export into your scenario. This will import the modules (with fields/settings/filters) shown in my screenshots above.

  1. Move your mouse over the line of code below. Copy the JSON by clicking the copy button on the right of the code, which looks like this:

  2. Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the editor.

  3. Click on each imported module and re-save it for validation. There may be some errors prompting you to remap some variables and connections.

JSON module export — paste this directly in your scenario

{"subflows":[{"flow":[{"id":280,"module":"json:ParseJSON","version":1,"parameters":{"type":""},"mapper":{"json":"[{\"array\":[{\"value\":\"<p><span style=\\\"font-size: 12pt;\\\"><meta charset=\\\"utf-8\\\" /><span style=\\\"color: #333333;\\\">\"},{\"value\":\"<strong><a href=\\\"/odkapavace-na-boty/\\\" title=\\\"OdkapávaÄŤe na boty\\\">\"},{\"value\":\"</a>\"},{\"value\":\"</strong>\"},{\"value\":\"<strong>\"},{\"value\":\"</strong>\"},{\"value\":\"<strong>\"},{\"value\":\"</strong>\"},{\"value\":\"<strong>\"},{\"value\":\"</strong>\"},{\"value\":\"</span></span></p>\\n<p><span style=\\\"font-size: 12pt; color: #333333;\\\"><meta charset=\\\"utf-8\\\" /></span></p>\\n<p><span style=\\\"font-size: 12pt; color: #333333;\\\">\"},{\"value\":\"<strong>\"},{\"value\":\"</strong>\"},{\"value\":\"<strong>\"},{\"value\":\"</strong>\"},{\"value\":\"<strong>\"},{\"value\":\"</strong>\"},{\"value\":\"<strong>\"},{\"value\":\"</strong>\"},{\"value\":\"<strong>\"},{\"value\":\"</strong>\"},{\"value\":\"<strong>\"},{\"value\":\"</strong>\"},{\"value\":\"<strong>\"},{\"value\":\"</strong>\"},{\"value\":\"</span></p>\\n<p><span style=\\\"font-size: 12pt; color: #333333;\\\"><meta charset=\\\"utf-8\\\" /></span></p>\\n<p><span style=\\\"font-size: 12pt; color: #333333;\\\"><meta charset=\\\"utf-8\\\" /><span style=\\\"color: #87432c; font-size: 18pt;\\\"><strong>\"},{\"value\":\"</strong></span></span></p>\\n<ul style=\\\"list-style-type: square;\\\">\\n<li><span style=\\\"font-size: 12pt; color: #333333;\\\">\"},{\"value\":\"</span></li>\\n<li><span style=\\\"font-size: 12pt; color: #333333;\\\">\"},{\"value\":\"</span></li>\\n<li><span style=\\\"font-size: 12pt; color: #333333;\\\">\"},{\"value\":\"</span></li>\\n<li><span style=\\\"font-size: 12pt; color: #333333;\\\">\"},{\"value\":\"</span></li>\\n<li><span style=\\\"font-size: 12pt; color: #333333;\\\">\"},{\"value\":\"</span></li>\\n</ul>\"}],\"__IMTAGGLENGTH__\":32}]"},"metadata":{"designer":{"x":1152,"y":-606},"parameters":[{"name":"type","type":"udt","label":"Data structure"}]}},{"id":281,"module":"json:ParseJSON","version":1,"parameters":{"type":""},"mapper":{"json":"[{\"array\":[{\"value\":\"Tento \"},{\"value\":\"praktický odkvapkávač\"},{\"value\":\" na obuv\"},{\"value\":\" s \"},{\"value\":\"ľahkým recyklovaným plastovým materiálom\"},{\"value\":\" a \"},{\"value\":\"moderným dizajnom\"},{\"value\":\" je perfektný na každodenné použitie a zvládne akékoľvek počasie. ÄŒi už ide o udržanie čistoty pred vchodovými dverami alebo o uložení mokrej obuvi v aute, tento produkt je skvelou voľbou pre vÅ¡etkých, ktorí ocenia \"},{\"value\":\"funkčnosÅ¥ a jednoduchú údržbu\"},{\"value\":\"Vďaka svojim rozmerom a \"},{\"value\":\"vysokej hrane\"},{\"value\":\" skvele chráni podlahu pred prebytkom vody, ktorý sa z topánok odkvapkáva. Je dostatočne veľký, aby pojal až \"},{\"value\":\"tri páry topánok\"},{\"value\":\" a skvele poslúži aj pre \"},{\"value\":\"čižmy, snehule, korčule\"},{\"value\":\" a ďalÅ¡ie mokré alebo znečistené obuvy. \"},{\"value\":\"Multifunkčné použitie\"},{\"value\":\" je jeho veľkou výhodou. Odkvapkávač je vhodný nielen pre domácnosti, ale aj na použitie v \"},{\"value\":\"interiéri aj exteriéri\"},{\"value\":\", ako sú chodby, kancelárie, dielne, balkóny, garáže alebo dokonca autá. \"},{\"value\":\"Jednoduchá údržba\"},{\"value\":\" a \"},{\"value\":\"ľahko umývateľný plast\"},{\"value\":\" znamenajú, že ho môžete ľahko čistiÅ¥ a udržiavaÅ¥ v perfektnom stave.\"},{\"value\":\"Multifunkčné použitie\"},{\"value\":\"Odkvapávač na obuv pre domácnosÅ¥\"},{\"value\":\"Podložka do kufra auta na uloženie vecí bez neporiadku\"},{\"value\":\"Podložka pod misky pre zvieratá\"},{\"value\":\"Pracovná plocha pre náradie a maliarske potreby\"},{\"value\":\"Podložka na presádzanie rastlín\"}],\"__IMTAGGLENGTH__\":31}]"},"metadata":{"designer":{"x":1410,"y":-597},"parameters":[{"name":"type","type":"udt","label":"Data structure"}]}},{"id":282,"module":"builtin:BasicRepeater","version":1,"parameters":{},"mapper":{"start":"1","repeats":"{{length(280.array)}}","step":"1"},"metadata":{"designer":{"x":1710,"y":-597}}},{"id":283,"module":"util:TextAggregator","version":1,"parameters":{"rowSeparator":"","feeder":282},"mapper":{"value":"{{280.array[282.i].value}}{{281.array[282.i].value}}"},"metadata":{"designer":{"x":1956,"y":-596,"messages":[{"category":"last","severity":"warning","message":"A transformer should not be the last module in the route."}]},"parameters":[{"name":"rowSeparator","type":"select","label":"Row separator","validate":{"enum":["\n","\t","other"]}}]}}]}],"metadata":{"version":1}}

Note: Did you know you can reduce the size of blueprints and module export code like the above, using the Make Blueprint Scrubber?

Thank you so much! This is exactly what I needed!!

Really appreciate your help :grin:

No problem, really glad I could help!

1. If anyone has a new question in the future, please start a new thread. This makes it easier for others with the same problem to search for the answers to specific questions, and you are more likely to receive help since newer questions are monitored closely.

2. The Make Community guidelines encourages users to try to mark helpful replies as solutions to help keep the Community organized.

This marks the topic as solved, so that:

  • others can save time when catching up with the latest activity here, and
  • allows others to quickly jump to the solution if they come across the same problem

To do this, simply click the checkbox at the bottom of the post that answers your question:
Screenshot_2023-10-04_161049

3. Don’t forget to like and bookmark this topic so you can get back to it easily in future!

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.

1 Like