How to `join` an Array of String with a prefix for each string?

How to use the join function and define a prefix for each string in the Array?

For example:

[ "company,asc", "dueDate,asc", "id,desc" ]

I want to get as result the right string:

"?sort=company,asc&sort=dueDate,asc&sort=id,desc"

@AndyDaSilva52

Something like this:
?{{join(split("company,asc;dueDate,asc;id,desc"; ";"); "&sort=")}}

Replace split("company,asc;dueDate,asc;id,desc"; ";") with your array reference.


Jim - The Monday Man (YouTube Channel)
What is Make & How can it help you with monday?
We Create Custom Solutions - Your Make or Ours
Schedule a 1-on-1 Tutorial Session (for monday, Make or Excel)

2 Likes

:sweat_smile:

I made a change considering that the array could be empty and the sort= has to happen just after ? (question mark)

{{if(length(0.array) >= 1; "?sort=" + join(0.array; "&sort="); emptystring)}}

@JimTheMondayMan Thanks for the help.

1 Like