Is there a way to call a block by the block name as a variable? | XM Community
Question

Is there a way to call a block by the block name as a variable?


Userlevel 1
Badge

After showing each page, I want to show a corresponding block on the next page depending on the date information of the responder working on that page. In specific, If DayInfor == Monday, then next show a block named Monday. I will have to do this 'if then' branch for 7 days of a week after each page. Since the embedded data name is the same as the block name. I wonder if there is an easy way to call a block by the block name as a variable. A custom code I am looking for which I can put into JS of a question in that page or in the header is like,
If(DayInfor == Monday)
{
Qualtrics.SurveyEngine.showBlockByName ("DayInfor")
}
Does this API method 'showing block by their name' actually exist? If it does not exist, is there any alternative way to do it? Thank you very much!
Screen Shot 2021-06-09 at 12.52.06 PM.png


3 replies

Userlevel 7
Badge +21

After having seen your other questions also, I don't think hard coding your survey in Qualtrics would be a solution for you.
My recommendation would be pull in your data from a web service and populate your questions dynamically. Let me know if you need help with that.

Userlevel 1
Badge

ahmedA
Thank you so much for your response. I read about Qualtrics tutorial for web service. I understand that I could save embedded data more easily. But I don't understand how web service can alleviate me from 'if then ' branches which help me to populate my questions dynamically, or namely, help me to display my question block when a certain condition is met. Can you instruct more about how web service can populate my questions dynmaically? Thank you! https://www.qualtrics.com/support/survey-platform/survey-module/survey-flow/advanced-elements/web-service/?utm_lp=related+page

Userlevel 7
Badge +21

Web service call allows you to store embedded data from the respose you receive. The basic flow will be that you store your data externally, like Google sheets or something. Peform your calculations, pull the relevant data and store it as an ed. In your question config, you will be displaying this ED.

Leave a Reply