Merge multiple array in a single array

Hi,

I hope you can help me. I have this collection of multiple arrays, containing emails. As an end result I would like to obtain a single array of emails.

I have tried the map function, but as I don’t have a key I can’t use this method! I have also tried merge, but as the number of arrays is variable I don’t understand how to set it.

How could I do this? Thank you!

Since that is a collection, you’ll have to convert it into an array before you can merge the sub-items.

You can use the built-in function toArray

e.g.:

toArray(34.noempty_string)

Then you should be able to iterate and Text Aggregate the email addresses.

If you need further assistance, please provide the following:

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”.
Screenshot_2023-10-06_141025

A.

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

Uploading them here will look like this:

module-1-input-bundle.txt (12.3 KB)
module-1-output-bundle.txt (12.3 KB)

B.

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles in this manner:

  • Either add three backticks ``` before and after the code, like this:

    ```
    input/output bundle content goes here
    ```

  • Or use the format code button in the editor:
    Screenshot_2023-10-02_191027

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!

samliewrequest private consultation

Join the unofficial Make Discord server to chat with other makers!

1 Like

Hi sam,

thanks a lot for your help!

I used the toArray function, but now I have an array of collections! How can i merge all in a unique array of emails?

This is the output bundle:

Output bundle.txt (611 Bytes)

Thanks,
Luca

First step down :slight_smile:

An array of collections is easier to manage compared to a collection of arrays!

Screenshot_2024-06-04_220605

Screenshot_2024-06-04_220615

Screenshot_2024-06-04_220653

samliewrequest private consultation

Join the unofficial Make Discord server to chat with other makers!

2 Likes

Hi sam,

good, it works well!

Thanks a lot for your help

2 Likes

@LucaDip - @samliew has a perfect solution for this and well done to both of you to get it working. Can I suggest my video series for Make Newbies that will take you through a whole set of fun videos and samples to manage data structures like this?

It will help you immensely as you continue your Maker journey.

2 Likes