I have choice field which is multiple selecting , but I need the value one by one like following are my choices
and I need to get values like this (“h1, h2, h3, h4”)
Hey @RJChauhan, for Multicheckbox fields like this HubSpot has them as semi colon delimited. You’d need to run a bit of custom code to transform this data like you want.
// Create a variable to store the string
let str = "apple;orange;banana;grapes;pineapple";
// Use the replace() method to replace the semicolons with a comma and space
let newStr = str.replace(/;/g, ", ");
// Print the transformed string
console.log(newStr); // Output: apple, orange, banana, grapes, pineapple
@BryantworksThanks, yes I already did with JS but I need the solution with HUBL. What happpen when I need values sepratly one by one , @hubspot must give the solution for this
As noted a checkbox value is a semicolon string. Most cases depending on what you are wanting to do you’ll coerce that into an array with a split(), or if you are simply wanting to replace the semicolon’s you can use a replace() filter:
{{ "Apples;Oranges;Limes"|split(';')|join(', ') }}<br>
{{ "Apples;Oranges;Limes"|replace(';', ', ') }}
Apples, Oranges, Limes
Apples, Oranges, Limes