How to flatten an array of strings into a single string with just functions?

Hi all,

This should be a super simple one, but I seem to have got stuck.

I’m using the Make.com module to output a list of active scenarios. I use an array aggregator to convert the bundle list into an array. I’m then trying to use the flatten function to simplify the array and convert any nested arrays to a concatenated string. Finally, I push this array to Google sheets (using Bulk Add Rows, which takes an array as it’s main input).

My issue is that flatten(array_name) doesn’t appear to be doing anything. I’d like it to have the structure of the ‘hopeful_array’ shown below.

Note: I’m trying to do this in a way that uses functions to save on Make.com operations.

my_flattened_array 
{
  "id": "1",
  "name": "scenario name",
  "usedPackages": [
    "xero",
    "util"
  ], 
}

hopeful_array
{
  "id": "1",
  "name": "scenario name",
  "usedPackages": "xero, util",
}

Thanks so much!
Antony

Welcome to the Make community!

To do this, you can use the built-in function join

{{ join(array; separator) }}

For more information, the function’s documentation can be found in the Help Centre. You should also complete the tutorials in the Make Academy.

But first, READ THIS

Combining Bundles Using Aggregators

Every result (item/record) from trigger/iterator/list/search/match modules will output a bundle. This can result in multiple bundles, which then trigger multiple operations in future modules (one operation per bundle). To “combine” multiple bundles into a single variable, you’ll need to use an aggregator of some sort.

Aggregators are modules that accumulate multiple bundles into one single bundle. An example of a commonly-used aggregator module is the Array aggregator module. The next popular aggregator is the Text Aggregator which is very flexible and can apply to many use-cases like building of JSON, CSV, HTML.

You can find out more about the other types of aggregator modules here:

Mapping a Specific Structure Into a Complex Field

The Array Aggregator module is very powerful because it allows you to build a complex array of collections for a later module’s field to map multiple items (collections) to it.

This is done using the “Target structure type” field in an Array Aggregator module.

Here is an example:

As you can see, the “Map” toggle on complex fields are used when you have an array. You can easily build an array variable to map to a future module’s field, by using an Array Aggregator module and select the “Target Structure Type” as the future module’s field you have mapped the array into.

Example

Here is an example of how your scenario could look:
Screenshot_2025-03-14_200347

That’s all you need, really.

Screenshot_2025-03-14_200352

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.

2 Likes

Wow, thanks so much Sam!

I hadn’t realised that the array aggregators were so powerful!

My learnings:

  1. Utilise Target Structure Type of the Array Aggregator to mould your dataset into a form ready to pipe into another module like Google Sheets. So powerful!

  2. Discovered the use of the join function for turning arrays into a single string! So simple. I can’t believe I didn’t know this.

Thank you so much. Down to 3 operations for outputting all my scenarios and their details into a Google spreadsheet! Fantastic!

I’ve added a screenshot of how my array aggregator is now set up.

No problem, really glad I could help! Thank you for providing all the requested information — that allowed me to come to a solution quickly.

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