How do I combine the array into one field with comma as its delimeter
Hoping someone can share their expertise. I've got this Define Transformation Output below. How can I combine the GroupPricing array into one field and using comma as it's delimeter? Many thanks in advance.
{
"id": "8532408",
"Name": "Test Customer",
"GroupPricing": [
{
"NuOrder Group Pricing": "Bags__33% CAD"
},
{
"NuOrder Group Pricing": "Lifestyle__50% CAD"
},
{
"NuOrder Group Pricing": "NC 45__45% CAD"
},
{
"NuOrder Group Pricing": "NC 50__50% CAD"
},
{
"NuOrder Group Pricing": "NC 55__55% CAD"
},
{
"NuOrder Group Pricing": "NC 60__60% CAD"
},
{
"NuOrder Group Pricing": "NC 65__65% CAD"
},
{
"NuOrder Group Pricing": "NC 70__70% CAD"
},
{
"NuOrder Group Pricing": "NC 75__75% CAD"
},
{
"NuOrder Group Pricing": "NC 80__80% CAD"
}
]
}
0
Comments
Raul Bernales would this work for you? Note you can't use handlebars in the export transform, but an use them in mappings downstream. You may also need to add record.GroupPricing to the initial each statement.
{
"id": "{{id}}",
"GroupPricing": "{{#each GroupPricing}}{{#if @index}},{{/if}}{{"NuOrder Group Pricing"}}{{/each}}"
}
Hi Tyler,
That's exactly what I need. Glad I finally was brave enough to ask. Many thanks for sharing your knowledge. Appreciate it a lot.
Hi Matthew,
That looks great too. At least I have different approach right now. Many thanks!
Raul - Matthew’s is actually better because it won’t add a comma for the last string!
How many options is too many options?? :)
Good day. I hope I can still post here. Let me know if I need to start another thread.
Below is our current company sync to our B2B system. Take note that a company can have multiple shipping addresses. In this example, company 8512472 has two shipping addresses, while company 8571161 has only one.
We are trying to include the "pricing group" and below is the result when we modify the netsuite saved search.
How can we transform that to combine the pricing group into one separated by comma. Below is what we want to achieve.
Would appreciate any expert advise. Thanks in advance.
Please sign in to leave a comment.