Help

Re: Prefill Form with Multiselect field containing commas

Solved
Jump to Solution
1973 0
cancel
Showing results for 
Search instead for 
Did you mean: 
stefpist
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi,

I have a multiselect field containing topics. It is a linked field to another table and each topic might contain a comma within its value. I need to prefill a form with that data but I find 
Is it possible or do I have to remove the commas within the field values?

Example of topics:
Agricoltura, Ambiente e Territorio, Calamità Naturali
Politiche per il Lavoro, Formazione Professionale e Servizio Civile
Cultura

Formulas I tried:

This only fills the first topic:

 

CONCATENATE(
    IF(
        "Prefilling [Form Preferenze] view in [Contatti] table in base with id 'appYSPQbVoKOqpys7'",
        "https://airtable.com/appYSPQbVoKOqpys7/shrVvuD1tVKS88IiG"
    ),
    CONCATENATE(
        "?prefill_" & ENCODE_URL_COMPONENT("Temi di Interesse"),
        "=" & ENCODE_URL_COMPONENT({Temi di Interesse} & "")
    )
)

 

If I try to remove the comma+space, it doesn't work for the topics that have that inside them:

 

"&prefill_" & ENCODE_URL_COMPONENT("Temi di Interesse"),
        "=" & SUBSTITUTE(SUBSTITUTE({Temi di Interesse},", ",",")," ","+" & "")

 

I tried ARRAYJOIN with a delimiter different from the comma, but it always separates using commas no matter what:

ARRAYJOIN({Temi di Interesse} ,";")
=>
"Agricoltura, Ambiente e Territorio, Calamità Naturali", "Politiche per il Lavoro, Formazione Professionale e Servizio Civile", Cultura

 

@kuovonne FYI I also tried your extension and it worked great for all fields except this one.

Thanks

 

1 Solution

Accepted Solutions
Sho
11 - Venus
11 - Venus

Sorry, I didn't assume multiple select.

Add a Rollup field and roll up the primary field for "Temi di Interesse".
The formula is this

"https://airtable.com/appYSPQbVoKOqpys7/shrVvuD1tVKS88IiG?prefill_" &
ENCODE_URL_COMPONENT("Temi di Interesse") & "=" &
ENCODE_URL_COMPONENT('"' & ARRAYJOIN(values, '","') & '"')

 

See Solution in Thread

7 Replies 7
stefpist
5 - Automation Enthusiast
5 - Automation Enthusiast

This is the URL I get, but it's not prefilling:

https://airtable.com/appYSPQbVoKOqpys7/shrVvuD1tVKS88IiG?prefill_Temi%20di%20Interesse="Agricoltura,Ambiente+e+Territorio,Calamità+Naturali","Politiche+per+il+Lavoro,Formazione+Professionale+e+Servizio+Civile",Cultura
Sho
11 - Venus
11 - Venus

Hi @stefpist ,

This should work.

CONCATENATE(
    IF(
        "Prefilling [Form Preferenze] view in [Contatti] table in base with id 'appYSPQbVoKOqpys7'",
        "https://airtable.com/appYSPQbVoKOqpys7/shrVvuD1tVKS88IiG"
    ),
    CONCATENATE(
        "?prefill_" & ENCODE_URL_COMPONENT("Temi di Interesse"),
        "=" & ENCODE_URL_COMPONENT("\"" & {Temi di Interesse} & "\"")
    )
)
stefpist
5 - Automation Enthusiast
5 - Automation Enthusiast

@Sho thank you so much for the help, but it doesn't prefill:

stefpist_0-1697817988227.png

Sho
11 - Venus
11 - Venus

Hmmm, I had no problem with text strings.
If it is a "Link to another table" field, the formula is should be this

CONCATENATE(
    IF(
        "Prefilling [Form Preferenze] view in [Contatti] table in base with id 'appYSPQbVoKOqpys7'",
        "https://airtable.com/appYSPQbVoKOqpys7/shrVvuD1tVKS88IiG"
    ),
    CONCATENATE(
        "?prefill_" & ENCODE_URL_COMPONENT("Temi di Interesse"),
        "=" & ENCODE_URL_COMPONENT(TRIM({Temi di Interesse}))
    )
)

 

stefpist
5 - Automation Enthusiast
5 - Automation Enthusiast

I must be doing something wrong because only the first element prefills.

I made a visible duplicate, if anyone cares to have a look:

https://airtable.com/appDi2t3LL3pIMTmF/shrSlehBKeNGKPmNv

Thanks

Sho
11 - Venus
11 - Venus

Sorry, I didn't assume multiple select.

Add a Rollup field and roll up the primary field for "Temi di Interesse".
The formula is this

"https://airtable.com/appYSPQbVoKOqpys7/shrVvuD1tVKS88IiG?prefill_" &
ENCODE_URL_COMPONENT("Temi di Interesse") & "=" &
ENCODE_URL_COMPONENT('"' & ARRAYJOIN(values, '","') & '"')

 

stefpist
5 - Automation Enthusiast
5 - Automation Enthusiast

That was simply amazing. It works perfectly, thank you for taking the time to help, really appreciate it.