no back button after calculating embedded score | XM Community
Skip to main content

Hi all,
I would like my survey to do the following: when a participant comes to the end of the survey and has completed less than 80% of questions, a page warns them and gives them an opportunity to go back and answer more questions.
When I use the scoring feature to track the percentage of questions answered and then use score to trigger display logic for the warning, it does not allow the participant to go back, I believe because the score was calculated in an embedded data block placed just before. Is there an integrated feature that would allow score to be recalculated when they return to the end of the survey? Or will this require JavaScript?
Sorry if this question was already answered, have not been able to find a solution on here in my searching.

Commenting again to bump with further clarification:
I set the Score using an embedded data block at the end of my survey. The following element in the survey flow is a question with display logic set to only display if Score < 80%. This is where the back button becomes disabled.
Is it possible to get around this by using Javascript to reset Score just before the <80% warning block loads? I've attempted this with the following code, but it is not working. I believe for this to work, the program would have to run display logic before the first javascript instruction. Code and photo of survey flow below:
Qualtrics.SurveyEngine.addOnload(function()
{
Qualtrics.SurveyEngine.setEmbeddedData('Score', undefined);
});
Screen Shot 2021-12-08 at 4.58.28 PM.png


The missing back button is caused by having the embedded data element between blocks in your survey flow:
image.png(from https://www.qualtrics.com/support/survey-platform/survey-module/survey-options/survey-experience/#AddingABackButton)
You may be able to get around this by using Javascript to set the embedded data value rather than inserting the embedded data element.


Great idea mmoore ! I had tried to reset the Score to undefined via Javascript after defining it in an embedded data element, but I think this is a better option.
Posting my code here in case anyone comes across this. I messed with this for too long before realizing that the piped text for my desired value could not be written directly into the embedded data function. I had to set the piped text as a variable first.
Qualtrics.SurveyEngine.addOnUnload(function()
{
var x = "${gr://SC_0Asp7I5sXakHBgW/Score}"
Qualtrics.SurveyEngine.setEmbeddedData('Score', "x");
});


Leave a Reply