Dear community members, I would like to ask you for any advice regarding the problem with the usage of math operator for embedded data.
I just want to create a simple index by computation of the value of three responses and saving this value as embedded data for future use.
I created the foloving equation in the survey flow below source variable:
NormativeTrust_CT (set to number, but I tried also version without setting any variable type) = $e{ ( q://QID3/SelectedAnswerRecode/1 + q://QID3/SelectedAnswerRecode/2 + q://QID3/SelectedAnswerRecode/3 ) / 3 }
Despite repeated consultation with the manual (e. g. https://www.qualtrics.com/support/survey-platform/survey-module/editing-questions/piped-text/math-operations/) and forum, countless attempts of equation modification and check source variables in the survey project, I'm not able to get more than empty embedded variable NormativeTrust_CT in the data file.
Thank you for your advice.
Lukáš
Solved
Problem with math operator used as embedded data
Best answer by lizb311
Lukas_S That was helpful! If you're using a matrix, then you were right to use "Answer" instead of "Choice." So I recreated what you were trying to do, and actually ended up with the exact same calculation that you had. In short, you just need to make sure that your blank spaces are actually blank spaces and haven't been automatically converted into HTML
So the correct calculation is this (looks the same as what you originally had):
$e{ ( q://QID3/SelectedAnswerRecode/1 + q://QID3/SelectedAnswerRecode/2 + q://QID3/SelectedAnswerRecode/3 ) / 3 }I set up a test in my survey to make sure it would work - I added this descriptive text to check if it was correctly interpreting the recode values, if it would calculate the average correctly using only piped text, and if it would calculate correctly via embedded data. This is how I set that up in my survey builder:
And here's what my survey flow looked like:
As I said, at first, it didn't actually work for me, either. So in the descriptive text I made in the survey builder, I switched to the HTML view. If you do that, sometimes you'll see that it automatically translates spaces into the HTML - and that is what messed up the calculation. So go to HTML view, and anywhere you see
erase it and type a blank space instead. If you have a lot of formatting, you might need to click the "remove formatting" button, too.

Once you've made all the edits, copy and paste that corrected version into your survey flow. That worked for me, to make sure that the blank space issue was resolved.
And then it should work! Here you can see in a Survey Preview, I selected what should be all 5's:
And these are the results I see on the next page:
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.

My goal is to create the index ((numeric value of the answer of question 1 + numeric value of the answer of question 2 + numeric value of the answer of question 3) / 3). All answers have set numeric value:
I tried to use your suggested piped text based on the "selected choice" expression, but my embedded variable still does not work.