Forum Discussion
Sum many text variables in one variable
David,
first of all thank you.
Let me explain what I'm doing. The purpose is to send to LMS a text variable (called "result1") using a hidden survey question in order to track quiz results. My need is to be able to know in a 10 questions quiz, to which question the student answered right or wrong. Also, since the test has 60 seconds time limit, I need to know to which question the student didn't answered.
This is what I did. When the scorm starts I set 10 text variables in this way:
Q_1= "TC1x", Q_2="TC2x", Q_3="TC3x".... and so on... (the x after the number stands for "not answered yet")
I also create another text variable called "Result1" and set it "AAAAAAAAAA" as default value.
When the person answer the first question, variable Q_1 will change from value "TC1x" to "TC1y" in case the student got that right, or "TC1n" in case of wrong answer. The same process will go for the other nine questions. If the student can't answer to some questions because of the time, the value will remain "x" (for instance "TC9x", "TC10x" if he couldn't answer to the last two questions)
I would like that "result1" will have inside the results of those ten questions that the student answered before. As I said, the result of those questions are the text variables from Q_1 to Q_10. The main purpose is to make the LMS to read this "result1" variable and build a report according to its content.
This is what I did according to what you wrote:
var player = GetPlayer();
var jsQ1 = player.GetVar("Q_1");
var jsQ2 = player.GetVar("Q_2");
var jsQ3 = player.GetVar("Q_3");
var jsQ4 = player.GetVar("Q_4");
var jsQ5 = player.GetVar("Q_5");
var jsQ2 = player.GetVar("Q_6");
var jsQ3 = player.GetVar("Q_7");
var jsQ4 = player.GetVar("Q_8");
var jsQ1 = player.GetVar("Q_9");
var jsQ2 = player.GetVar("Q_10");
player.SetVar("Result1", jsQ_1+" "+jsQ_2+" "+jsQ_3+" "+jsQ_4)+" "+jsQ_5+" "+jsQ_6+" "+jsQ_7)+" "+jsQ_8+" "+jsQ_9+" "+jsQ_10)
So, my goal is to obtain from "Result1" something like : "TC1n TC2y TC3n TC4n TC5y TC6y TC7y TC8x TC9x TC10x"...... which can be transformed in a report that says which one was wrong, right, or not answered.
But... is not working. In the last slide, after the JS, I have a text box with "Result1" in, that stays on the AAAAAAAAAA value that I set as default at the beginning... What am I doing wrong?
Thank you very much and sorry for my really poor english... I'm italian and I have learned it from The Simpsons...
Related Content
- 12 months ago
- 12 months ago
- 12 months ago
- 12 months ago
- 12 months ago