How to combine items within a collection into a single string

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).

The results of this parser you can see in the pic

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

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)

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
(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

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!

1 Like

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.

See the above quote.

blueprint (1).json (123.0 KB)

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/\” >\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/\” >\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/\” >\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/\” >\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/\” >\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/\” >\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/\” 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/\” 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/\” 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
}
]

blueprint (1).json (123.0 KB)

jsonvalidator.json (5.1 KB)
This is the text aggregator

jsonvalidator (1).json (4.5 KB)
And this the text parser

Option 1

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

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

Screenshot_2023-12-14_101228

Output

Screenshot_2023-12-14_101230

2 Likes

Option 2

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

Screenshot_2023-12-14_101255

then split by newlines:

Output

Screenshot_2023-12-14_101209

2 Likes

Amazing, Thank you! That worked

2 Likes