# How to combine items within a collection into a single string

**URL:** <https://community.make.com/t/how-to-combine-items-within-a-collection-into-a-single-string/21757>\
**Category:** Questions\
**Tags:** arrays\
**Created:** [December 13, 2023, 7:31am UTC](https://community.make.com/t/how-to-combine-items-within-a-collection-into-a-single-string/21757 "2023-12-13T07:31:37Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pepin\_Isliker](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@Pepin\_Isliker](https://community.make.com/u/Pepin_Isliker)\
**Post date:** [December 13, 2023, 7:31am UTC](https://community.make.com/t/how-to-combine-items-within-a-collection-into-a-single-string/21757/1 "2023-12-13T07:31:37Z")

</div>

Hi everyone,

Trying to figure something out which I thought should be simple:

So I am running an API call to retrieve the raw HTML code from a website. From this HTML I used a Text Parser to retrieve the headings of the page (which is my goal).

 ![Screenshot 2023-12-13 at 08.20.38](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/e/d/ed69b61abcf1db5b120a64d76f032f02da75bf00.png)

The results of this parser you can see in the pic

 ![Screenshot 2023-12-13 at 08.21.28](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/d/9/d99f90ac1637268bae3f10b730e0807468111ec1.png)

THEN  
I use an array aggretator to get the data shown in the third pic

 ![Screenshot 2023-12-13 at 08.22.08](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/8/7/875437a6ca212f13c9ad69e6cc86f1f512b314a3.png)

Now what my goal is:  
I want to extract the two items within the collection, and combine them into one string.  
$1 - $2. Which gives a string like this: “h1 - A Gut Friendly Guide to …”

For EACH collection within the array this needs to be done. Each new strings needs to go to a unique colomn in the same row in Google Sheet

What I tried:  
Use “Set Multiple Variables”. Combine $1 and $2. But for a some reason (the reason being my lack of knowledge) when I want to map the array it only shows me two values… (there are 40 heading combinations)

 ![Screenshot 2023-12-13 at 08.28.45](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/8/f/8f3ca584b9a49ad610aa7a497579c98c265cc76a.png)

---

<div class="post-metadata">

**Author:** ![samliew](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/samliew/32/13327_2.png) [@samliew](https://community.make.com/u/samliew)\
**Post date:** [December 13, 2023, 8:40am UTC](https://community.make.com/t/how-to-combine-items-within-a-collection-into-a-single-string/21757/2 "2023-12-13T08:40:00Z")

</div>

Welcome to the Make community!

## 1. Scenario blueprint

Please export the scenario blueprint file to allow others to view the mappings and settings. At the bottom of the scenario editor, you can click on the three dots to find the Export Blueprint menu item.

 ![Screenshot_2023-08-24_230826](https://europe1.discourse-cdn.com/flex013/uploads/make/original/2X/2/2ff55ee04419049c127f183db2b3eebfbbbbfc64.png)  
(Note: Exporting your scenario will not include private information or keys to your connections)

Uploading it here will look like this:

> blueprint.json (12.3 KB)

## 3. And most importantly, Output bundles

Please provide the output bundles of the modules by running the scenario, then click the white speech bubble on the top-right of each module, save the bundle contents in your text editor as a `bundle.json` file, and upload it here into this discussion thread.

 ![Screenshot_2023-10-06_141025](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/2/8/2876156ab3ea5bc9e40bbc0edfb9f025406b7c48.png)

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

Following these steps will allow others to assist you here. Thanks!

---

<div class="post-metadata">

**Author:** ![Pepin\_Isliker](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@Pepin\_Isliker](https://community.make.com/u/Pepin_Isliker)\
**Post date:** [December 13, 2023, 9:40am UTC](https://community.make.com/t/how-to-combine-items-within-a-collection-into-a-single-string/21757/3 "2023-12-13T09:40:46Z")

</div>

Ofcourse!

If I export it as a Blueprint will the API keys and my OpenAI account go with it? Or is it safe to share.

---

<div class="post-metadata">

**Author:** ![samliew](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/samliew/32/13327_2.png) [@samliew](https://community.make.com/u/samliew)\
**Post date:** [December 13, 2023, 9:43am UTC](https://community.make.com/t/how-to-combine-items-within-a-collection-into-a-single-string/21757/4 "2023-12-13T09:43:57Z")

</div>

> [@samliew](#):
>
> (Note: Exporting your scenario will not include private information or keys to your connections)

See the above quote.

---

<div class="post-metadata">

**Author:** ![Pepin\_Isliker](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@Pepin\_Isliker](https://community.make.com/u/Pepin_Isliker)\
**Post date:** [December 13, 2023, 9:54am UTC](https://community.make.com/t/how-to-combine-items-within-a-collection-into-a-single-string/21757/5 "2023-12-13T09:54:49Z")

</div>

[blueprint (1).json](https://community.make.com/uploads/short-url/bGGYssc68vW80onsoGt3Zh50m1C.json) (123.0 KB)

```auto
This is from the array aggregator. I can also share the others if needed

```

[  
{  
“array”: [  
{  
“$1”: “h1”,  
“$2”: “A Gut-Friendly Guide to Drinking Coffee With IBS”  
},  
{  
“$1”: “h2”,  
“$2”: “\n\t\t\t\tTable of Contents\t\t\t”  
},  
{  
“$1”: “h2”,  
“$2”: “What’s in coffee?”  
},  
{  
“$1”: “h2”,  
“$2”: “How Does Coffee Impact IBS Symptoms?”  
},  
{  
“$1”: “h3”,  
“$2”: “Stomach Acid”  
},  
{  
“$1”: “h3”,  
“$2”: “Gut Motility”  
},  
{  
“$1”: “h3”,  
“$2”: “Stress Response”  
},  
{  
“$1”: “h3”,  
“$2”: “Environmental Triggers”  
},  
{  
“$1”: “h3”,  
“$2”: “Salicylates”  
},  
{  
“$1”: “h2”,  
“$2”: “How do you know if caffeine is an IBS trigger?”  
},  
{  
“$1”: “h2”,  
“$2”: “Can Coffee Lower Your Risk of IBS?”  
},  
{  
“$1”: “h2”,  
“$2”: “Can I Drink Coffee if I Have IBS?”  
},  
{  
“$1”: “h2”,  
“$2”: “Can I Drink Coffee on a Low-FODMAP Diet?”  
},  
{  
“$1”: “h2”,  
“$2”: “Coffee Additives”  
},  
{  
“$1”: “h3”,  
“$2”: “What to Add”  
},  
{  
“$1”: “h3”,  
“$2”: “What to Avoid”  
},  
{  
“$1”: “h2”,  
“$2”: “Caffeine Content and Recommendations”  
},  
{  
“$1”: “h2”,  
“$2”: “Coffee Alternatives”  
},  
{  
“$1”: “h2”,  
“$2”: “How to Cut Back on Caffeine”  
},  
{  
“$1”: “h2”,  
“$2”: “Ready to take control of your IBS?”  
},  
{  
“$1”: “h2”,  
“$2”: “Sources”  
},  
{  
“$1”: “h4”,  
“$2”: “Share this Post”  
},  
{  
“$1”: “h4”,  
“$2”: “\n\t\t\t\t\t\t\tJennifer Thompson\t\t\t\t\t\t”  
},  
{  
“$1”: “h4”,  
“$2”: “Search Articles”  
},  
{  
“$1”: “h4”,  
“$2”: “Latest Posts”  
},  
{  
“$1”: “h3”,  
“$2”: “\n\t\t\t\<a href="[https://primehealthdenver.com/power-of-food/\](https://primehealthdenver.com/power-of-food/%5C)” \>\n\t\t\t\tHarnessing the Power of Food: The Foundation of Functional Medicine\t\t\t\n\t\t"  
},  
{  
“$1”: “h3”,  
“$2”: “\n\t\t\t\<a href="[https://primehealthdenver.com/methylene-blue/\](https://primehealthdenver.com/methylene-blue/%5C)” \>\n\t\t\t\tWhat is Methylene Blue? Benefits, Side Effects, Interactions\t\t\t\n\t\t"  
},  
{  
“$1”: “h3”,  
“$2”: “\n\t\t\t\<a href="[https://primehealthdenver.com/can-ibs-cause-back-pain/\](https://primehealthdenver.com/can-ibs-cause-back-pain/%5C)” \>\n\t\t\t\tCould IBS Be to Blame for Your Back Pain?\t\t\t\n\t\t"  
},  
{  
“$1”: “h3”,  
“$2”: “\n\t\t\t\<a href="[https://primehealthdenver.com/ibs-probiotics/\](https://primehealthdenver.com/ibs-probiotics/%5C)” \>\n\t\t\t\tHow Probiotics For IBS Can Fight Digestive Problems\t\t\t\n\t\t"  
},  
{  
“$1”: “h3”,  
“$2”: “\n\t\t\t\<a href="[https://primehealthdenver.com/bowel-cancer-stomach-noises/\](https://primehealthdenver.com/bowel-cancer-stomach-noises/%5C)” \>\n\t\t\t\tStomach Growling and Bowel Cancer: When to Seek Immediate Care\t\t\t\n\t\t"  
},  
{  
“$1”: “h3”,  
“$2”: “\n\t\t\t\<a href="[https://primehealthdenver.com/ibs-flare-up/\](https://primehealthdenver.com/ibs-flare-up/%5C)” \>\n\t\t\t\tHow to Find Lasting Relief From IBS Flare-Ups\t\t\t\n\t\t"  
},  
{  
“$1”: “h4”,  
“$2”: “Post Categories”  
},  
{  
“$1”: “h4”,  
“$2”: “Related Articles”  
},  
{  
“$1”: “h4”,  
“$2”: “\<a href="[https://primehealthdenver.com/power-of-food/\](https://primehealthdenver.com/power-of-food/%5C)” rel="bookmark" title="Harnessing the Power of Food: The Foundation of Functional Medicine" class="post-title"\>Harnessing the Power of Food: The Foundation of Functional Medicine"  
},  
{  
“$1”: “h4”,  
“$2”: “\<a href="[https://primehealthdenver.com/methylene-blue/\](https://primehealthdenver.com/methylene-blue/%5C)” rel="bookmark" title="What is Methylene Blue? Benefits, Side Effects, Interactions" class="post-title"\>What is Methylene Blue? Benefits, Side Effects, Interactions"  
},  
{  
“$1”: “h4”,  
“$2”: “\<a href="[https://primehealthdenver.com/can-ibs-cause-back-pain/\](https://primehealthdenver.com/can-ibs-cause-back-pain/%5C)” rel="bookmark" title="Could IBS Be to Blame for Your Back Pain?" class="post-title"\>Could IBS Be to Blame for Your Back Pain?"  
}  
],  
“ **IMTAGGLENGTH** ”: 36  
}  
]

```auto

```

---

<div class="post-metadata">

**Author:** ![Pepin\_Isliker](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@Pepin\_Isliker](https://community.make.com/u/Pepin_Isliker)\
**Post date:** [December 13, 2023, 10:08am UTC](https://community.make.com/t/how-to-combine-items-within-a-collection-into-a-single-string/21757/6 "2023-12-13T10:08:40Z")

</div>

[blueprint (1).json](https://community.make.com/uploads/short-url/bGGYssc68vW80onsoGt3Zh50m1C.json) (123.0 KB)

---

<div class="post-metadata">

**Author:** ![Pepin\_Isliker](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@Pepin\_Isliker](https://community.make.com/u/Pepin_Isliker)\
**Post date:** [December 13, 2023, 10:11am UTC](https://community.make.com/t/how-to-combine-items-within-a-collection-into-a-single-string/21757/7 "2023-12-13T10:11:07Z")

</div>

[jsonvalidator.json](https://community.make.com/uploads/short-url/3JvTJu92ywvutK66sKGowuh2XjM.json) (5.1 KB)  
This is the text aggregator

[jsonvalidator (1).json](https://community.make.com/uploads/short-url/2nuC9qBs8lV5zisA0aLJmNfYxbZ.json) (4.5 KB)  
And this the text parser

---

<div class="post-metadata">

**Author:** ![samliew](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/samliew/32/13327_2.png) [@samliew](https://community.make.com/u/samliew)\
**Post date:** [December 14, 2023, 2:30am UTC](https://community.make.com/t/how-to-combine-items-within-a-collection-into-a-single-string/21757/8 "2023-12-14T02:30:44Z")

</div>

# Option 1

After your match pattern, you can “Compose a string” before the “Array Aggregator”.

 ![Screenshot_2023-12-14_101240](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/0/f/0f67dcc321d39771da1dc4398307d66bb94b9c1e.png)

In the “Compose a string” module, you can clean up the text input by using replace and trim functions.

 ![Screenshot_2023-12-14_101228](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/1/f/1f598b0ac05ffe1b23075d09aa6d858b8329eefd.png)

## Output

 ![Screenshot_2023-12-14_101230](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/4/e/4eac5b9c0e420b9fe6bdf282b5692b4ed38d7d52.png)

---

<div class="post-metadata">

**Author:** ![samliew](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/samliew/32/13327_2.png) [@samliew](https://community.make.com/u/samliew)\
**Post date:** [December 14, 2023, 2:36am UTC](https://community.make.com/t/how-to-combine-items-within-a-collection-into-a-single-string/21757/9 "2023-12-14T02:36:10Z")

</div>

# Option 2

If you want to save on operations, you can directly aggregate to text first,

 ![Screenshot_2023-12-14_101255](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/c/4/c499b0bbdc125ef85bf8634685b88178c5de95b8.png)

 ![Screenshot_2023-12-14_101206](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/a/3/a3dc80eabcb6aecd5b512b372a2f41705760ef80.png)

then split by newlines:

 ![Screenshot_2023-12-14_101258](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/f/f/fff2feb892f1eb9c77c1cdfa1ad060a99c801bc5.png)

## Output

 ![Screenshot_2023-12-14_101209](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/8/5/850bc3ebcdc90f3eb3b0bd019f0e15f0f349af72.png)

---

<div class="post-metadata">

**Author:** ![Pepin\_Isliker](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@Pepin\_Isliker](https://community.make.com/u/Pepin_Isliker)\
**Post date:** [December 14, 2023, 3:43pm UTC](https://community.make.com/t/how-to-combine-items-within-a-collection-into-a-single-string/21757/10 "2023-12-14T15:43:36Z")

</div>

Amazing, Thank you! That worked

---

<div class="post-metadata">

**Author:** ![Make\_Bot](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/make_bot/32/14661_2.png) [@Make\_Bot](https://community.make.com/u/Make_Bot)\
**Post date:** [December 29, 2023, 7:07am UTC](https://community.make.com/t/how-to-combine-items-within-a-collection-into-a-single-string/21757/11 "2023-12-29T07:07:44Z")

</div>

This topic was automatically closed because it's resolved or inactive. Please, start a new topic.


