Loop and merge based on embedded data field from web service | XM Community
Skip to main content

Hello, 

 

I am providing some sample products for my customers to taste.
 

The customers and each will select up to 5 and will get the survey to rate them.

I retrieve those products through a webservice which then feeds the embedded data (product name).

 I set the embedded data in the begining of the survey flow  with product names as Product_Name1, Product_Name2 etc.

Then I map those embedded data from the webservice as below: (url is empty for now, I will do the testing later) 

 

The questions will be the same for each product so I will use Loop&Merge functionality.

 

However, when I set the loop&merge based on the embedded data and as the customer might choose less than 5 products, I don’t know how to stop loop&merge if the embedded data turns empty. For example, if the customer chooses 3 products, Product_Name4 and Product_Name5 will be empty and I want to stop the loop after the 3rd time. 

 

Is there any way to set a condition in the survey flow to stop when the embedded data is empty by using the loop&merge functionality ? Or is there any custom code to make it happen?

Thanks in advance.

@sdevrez,

Add a MC question before the loop and add a choice for each product. Add display logic to each choice to only display it if the associated product name is not empty. Hide the question with JS and base the loop off the displayed choices in the question.


Brilliant @TomG thank you very much. It worked perfectly :)


Leave a Reply