Issue with Array and Text (replacing separator when some values are empty)

Hi everyone,

I have a scenario that goes like this :

  1. Webflow Form Submission
  2. Router
  3. Set Variable
  4. Create Record in my CRM
  5. Send an Email internally through Brevo Send Email integration

In the form, people have a multiselect where they can choose the type of equipment they own.

The Set Variable module handles that. And the ouput can look like below

[
    {
        "type_installation": [
            "PAC A/E",
            null,
            null
        ]
    }
]

or

[
    {
        "type_installation": [
            "PAC A/E",
            null,
            "PV"
        ]
    }
]

Now, in the subject and the body of my email I send the following:

ā€œType of equipment : {{10.type_equipment}}ā€ –> This is the Set Variable module.

The issue is that if the prospect selects only one service, I will receive

ā€œType of equipment : , , PVā€
or
ā€Type of equipment : "PAC A/E, ,

I tried some join / map / replace / trim, but I never make it work…

I would appreciate your help to make it work :slight_smile:

Cheers

Hey @Quentin_h33,

Use this formula to clean up the value:

{{trim(replace(10.type_equipment; ā€œ,ā€; ā€œā€))}}

Let me know if you need further clarification!
If this helps, kindly mark it as a solution :+1:

Hello @Probotic_Solutions ,

thanks for your help.

I tried your solution (just adapted it to my scenario): {{trim(replace(4.type_installation; ā€œ,ā€; ā€œā€))}}

But when I paste it, it looks like this:
Capture d’écran 2025-09-16 aĢ€ 17.29.52

If I try to update it to make it ā€œworkā€, then it doesn’t change anything :confused:
Capture d’écran 2025-09-16 aĢ€ 17.29.30
Capture d’écran 2025-09-16 aĢ€ 17.34.49
Capture d’écran 2025-09-16 aĢ€ 17.36.41

Any idea?

Hi @Quentin_h33,

Apologies for the misunderstanding. It’s a multiselect field where the user can select one or more options, including all. So, we just need to remove the empty elements from the array.

I tested it, and the following formula worked well:

{{remove(15.contacts; emptystring)}}
OR
{{remove(4.type_installation; emptystring)}}

Let me know how it goes. If this helps, please consider marking it as a solution. :+1:

Hello,

Thanks again for your help but it doesn’t seem to work.


Capture d’écran 2025-10-22 aĢ€ 18.18.05

ANy idea?

I was sure it would be simple but somehow I don’t manage to have it right…

Hey Quentin,

what does the incoming data literary look like? Can you paste the output bundle form the module here?

I tested with the JSON strings from your initial post and this works:

{{remove(1.type_installation; null; emptystring)}}

Basically use the remove() function on the incoming array and have it delete any values that are either null or empty strings.

2 Likes

Hello,

Thanks for your help, it worked!! I am a ā€œbitā€ perfectionist so you can’t imagine how happy I am thanks to you.

For your info

Here is the global scenario :

On the module ā€œSet Variableā€
Input :
[
{
ā€œnameā€: ā€œtype_installationā€,
ā€œscopeā€: ā€œroundtripā€,
ā€œvalueā€: [
null,
ā€œClimatisationā€,
null,
ā€œGazā€,
null,
null,
ā€œPlomberieā€,
null
]
}
]
Output :
[
{
ā€œtype_installationā€: [
null,
ā€œClimatisationā€,
null,
ā€œGazā€,
null,
null,
ā€œPlomberieā€,
null
]
}
]
Here is the module content
{{add(emptyarray; if(1.data.pac = ā€œtrueā€; ā€œPAC A/Eā€; ); if(1.data.clim = ā€œtrueā€; ā€œClimatisationā€; ); if(1.data.pv = ā€œtrueā€; ā€œPVā€; ); if(1.data.gaz = ā€œtrueā€; ā€œGazā€; ); if(1.data.fioul = ā€œtrueā€; ā€œFioulā€; ); if(1.data.domestic_hot_water = ā€œtrueā€; ā€œECSā€; ); if(1.data.bathroom = ā€œtrueā€; ā€œPlomberieā€; ); if(1.data.plumbing = ā€œtrueā€; ā€œPlomberieā€; ))}}

Thanks again!

1 Like