adding a question counter (index) within a specific block | XM Community
Question

adding a question counter (index) within a specific block

  • 27 April 2023
  • 2 replies
  • 120 views

Badge +2

Hey,

I've tried different solutions offered here about the topic, none worked so far. 

For my survey, I need to put some sort of index that shows the participants how many questions in the block have been presented so far out of the total (for example: question 10/45). It needs to be visible throughout answering the block. The question block itself is randomized, and with a graphics question in each page.

I have tried using embedded data (perheps wrong? Since it did not work in preview).

also I thought maybe it's possible to alter the progress bar in 'looks and feel'. If it can be added to some of the blocks but not to the whole survey, and maybe if it's possible to change the text? 

Any idea would be much appreciated!

I have zero to very little knowledge in code, but I'm willing to learn if the solution requires it.

Thanks,

Mia


2 replies

Userlevel 4
Badge +18

Hi @Miae12 - Indeed you can use standard progress bar with some customizations but in this case following would be bet approach:-

 

Define two embedded variables before you block:-

 

In survey Look & Feel→ General→ Header, place below script. This script will update value of “stage” variable after each screen. 

Question ${e://Field/Stage} out of ${e://Field/Total Questions}
<script>
Qualtrics.SurveyEngine.addOnPageSubmit(function() {
var currentStage= parseInt("${e://Field/Stage}")
Qualtrics.SurveyEngine.setEmbeddedData('Stage', currentStage+1);
console.log(currentStage)
});
</script>

 

This will show progress like “Question 2 out of 45” on top of screen but you can change position of this text using some css.

Hope this helps.

Badge +2

Hi @Miae12 - Indeed you can use standard progress bar with some customizations but in this case following would be bet approach:-

 

Define two embedded variables before you block:-

 

In survey Look & Feel→ General→ Header, place below script. This script will update value of “stage” variable after each screen. 

Question ${e://Field/Stage} out of ${e://Field/Total Questions}
<script>
Qualtrics.SurveyEngine.addOnPageSubmit(function() {
var currentStage= parseInt("${e://Field/Stage}")
Qualtrics.SurveyEngine.setEmbeddedData('Stage', currentStage+1);
console.log(currentStage)
});
</script>

 

This will show progress like “Question 2 out of 45” on top of screen but you can change position of this text using some css.

Hope this helps.

hey KimothiSaurabh,

thank you so much for your answer! it half worked.

it shows the header text but not the question numbers (my questions are graphic\text questions) like this: 

also it shows it on all blocks, even the ones without the embedded data branch before them, but I need it to be visible only on some of the blocks,

I also tried it in another survey with multiple choice questions and one block, and there it also kinda worked - it showed 1 out of 45 but it did not change when you go to the next question in the next page, what could be the problem? 

could it be something in the flow? or perhaps the question type? 

thanks for all the help,

Mia

 

Leave a Reply