You'll need to first transfer the score into another variable to get it passed through JavaScript. I think the GetPlayer method only grabs author generated variables. I haven't been able to pull any of the compound objects using that method.
Modify Variable myVariable to Results.ScorePoints when slide timeline starts.
alert("Your score is, " + player.GetVar("myVariable") + ".");
"Modify Variable myVariable to Results.ScorePoints when slide timeline starts."
When I try to do this I cannot see the "Results.ScorePoints" listed as a possible variable to use but "Results.ScorePoints" is listed among the variables.
Thanks for the quick reply. Yes I have the Results.ScorePoints variable created at the result slide and listed among the variables.
But the problem is that I cannot when I try to "Adjust" the variable and "Assign" it to "myVariable" in the trigger setting the "Results.ScorePoints" variable is not listed there and possible to select. Am I looking in the wrong place or is there another solution to Assign the variable?
You cannot adjust the result variable but you can send it to javascript.
Steve just a thought could you send the result to javascript and the adjust the result score in javascript and send it back, not tried it but it might be possible
Hi Bengt, I'm fairly new to Storyline, but I'd imagine you'd set it by adding a trigger to your results slide, with the following settings, for example.
You cannot adjust the result variable but you can send it to javascript.
Steve just a thought could you send the result to javascript and the adjust the result score in javascript and send it back, not tried it but it might be possible
I'm assuming since you're wondering if you can set Results.ScorePoints when you say that you can send Results to JavaScript you mean you can directly read the variable using player.GetVar("Results"). My experience is this is not the case. I must first copy the results variable value that I want into another variable. This is a bit of a pain with a course with lots of Results objects but it's not hard.
Just to add to the above, has anyone had any success passing this outside of articulate with the JS?
I have used one of Steves other js examples and the GetPlayer method to create a custom 'Certificate of Completion', however I need to find a solution to get the results from SL across to this new window, and cant work out how to take the results variable and push it in to a new variable for export.
Massive longshot, and probably incredibly difficult but worth the try...
I am fairly new to Storyline and your posts have been very helpful. However, I am just confused as to how to extract the result value from the Result page and export it through Javascript to an outside file like a .txt file. Is this possible please?
Thank you very much, I really appreciate your help on this.
Don't know if this will answer the problem, but there's a bit a code on the support site of Articulate. Here is the code for the export of variable that are edited by user (in this example, there are name and mail).
var fso = new ActiveXObject("Scripting.FileSystemObject"); var s = fso.OpenTextFile("C:\\Test.txt", 8, true, 0); // Replace the bold part with your file location
var name = player.GetVar("TextEntry"); var email = player.GetVar("TextEntry1"); s.WriteLine("Email: " + email); s.WriteLine("Name: " + name); s.WriteLine("=========="); s.Close();
For the score part, personnaly, I create by myself all the variables for result. If I got a quiz, I set a trigger on the Continue button of the feedback layer to modify my result variable.
Once this done, you can do whatever you want with this variable:
- Get it in a text file with the code upside,
- Call it on a slide or a text box or any objet with text and making it appearing at the start of the timeline,
- Or whatever you want! It's a variable, you can call it back as you want!
You cannot adjust the result variable but you can send it to javascript.
Steve just a thought could you send the result to javascript and the adjust the result score in javascript and send it back, not tried it but it might be possible
I'm assuming since you're wondering if you can set Results.ScorePoints when you say that you can send Results to JavaScript you mean you can directly read the variable using player.GetVar("Results"). My experience is this is not the case. I must first copy the results variable value that I want into another variable. This is a bit of a pain with a course with lots of Results objects but it's not hard.
Mike Bethany, I see you said, you would assign the results variable. But how? I made an Adjust Variable trigger, the variable is Answers ( something i made up ), operator is = Assignment ( pretty sure that's right ), the value is Variable ( also I'm pretty sure that's right ), and the value I have is Results from my Results page. Their variable, not mine.
But when I do player.GetVar('Answers').. I would expect a hash or some sort of integer representing the results. Instead I get the string "ScorePoints".. What am I missing here? I can't actually assign as a variable Results.ScorePoints.
It looks like your most recent posts have been in French, which may be why you haven't heard back from Cedric. Although Google Translate generally does a good job - I'm not sure I'm following the French->English translations that it's providing....
I've been trying to implement the solutions outlined in this (and several other) post on the issue of passing quiz results to an LMS but can't seem to get it to work.
I have a course with two paths a learner can choose from. At the end they complete a quiz based on the content they have reviewed. Obviously I can't have two result slides being passed to the LMS and if I use the 'result of results' option it averages the score (so basically divides the score in half as they only complete one of them).
So I have set up a Variable that takes the Result.ScorePoints figure and a Javascript that then passes that variable to the LMS. However, I've been testing this out in a short demo version in SCORM Cloud and it doesn't work :-(
Could someone take a look and see if they can spot the problem? The new variable is getting the Result.ScorePointsOK so it seems to be the Java bit that isn't working.
I managed to track down the issue in this file and thought I'd post here in case anyone else came across the same issue (or this thread).
When copying and pasting the code provided above, you need to change quotation marks to the ones on your keyboard. The ones above are converted into a web format which will stop the java script working.
Its a hard error to spot, but makes all the difference!
23 Replies
Hi, Graeme -
You'll need to first transfer the score into another variable to get it passed through JavaScript. I think the GetPlayer method only grabs author generated variables. I haven't been able to pull any of the compound objects using that method.
Modify Variable myVariable to Results.ScorePoints when slide timeline starts.
alert("Your score is, " + player.GetVar("myVariable") + ".");
Yup, thanks for that. Spot on.
Hi,
I tried to do this bu cannot figure out how to:
"Modify Variable myVariable to Results.ScorePoints when slide timeline starts."
When I try to do this I cannot see the "Results.ScorePoints" listed as a possible variable to use but "Results.ScorePoints" is listed among the variables.
Can you explain?
Thanks,
Bengt
Hi Bengt
Have you made sure that your course has a results slide? Without that, the Results.ScorePoints variable wont be created!
(BTW, if you create more than one Results slide, the next variable is called Results1.ScorePoints etc)
Graeme
Hi Graeme,
Thanks for the quick reply. Yes I have the Results.ScorePoints variable created at the result slide and listed among the variables.
But the problem is that I cannot when I try to "Adjust" the variable and "Assign" it to "myVariable" in the trigger setting the "Results.ScorePoints" variable is not listed there and possible to select. Am I looking in the wrong place or is there another solution to Assign the variable?
Thanks,
Bengt
You cannot adjust the result variable but you can send it to javascript.
Steve just a thought could you send the result to javascript and the adjust the result score in javascript and send it back, not tried it but it might be possible
Hi Phil,
Thanks for the respons. But how and where do I actually set "myVariable" to "Results.ScorePoints"? Is this done in Storyline or in JavaScript?
Thanks,
Bengt
Hi Bengt, I'm fairly new to Storyline, but I'd imagine you'd set it by adding a trigger to your results slide, with the following settings, for example.
I hope that helps.
Kev
I'm assuming since you're wondering if you can set Results.ScorePoints when you say that you can send Results to JavaScript you mean you can directly read the variable using player.GetVar("Results"). My experience is this is not the case. I must first copy the results variable value that I want into another variable. This is a bit of a pain with a course with lots of Results objects but it's not hard.
Thanks Mike, thought it might work
Hi Team,
Just to add to the above, has anyone had any success passing this outside of articulate with the JS?
I have used one of Steves other js examples and the GetPlayer method to create a custom 'Certificate of Completion', however I need to find a solution to get the results from SL across to this new window, and cant work out how to take the results variable and push it in to a new variable for export.
Massive longshot, and probably incredibly difficult but worth the try...
Hi All,
I am fairly new to Storyline and your posts have been very helpful. However, I am just confused as to how to extract the result value from the Result page and export it through Javascript to an outside file like a .txt file. Is this possible please?
Thank you very much, I really appreciate your help on this.
Kaye
Hi all!
Don't know if this will answer the problem, but there's a bit a code on the support site of Articulate. Here is the code for the export of variable that are edited by user (in this example, there are name and mail).
var fso = new ActiveXObject("Scripting.FileSystemObject");
var s = fso.OpenTextFile("C:\\Test.txt", 8, true, 0); // Replace the bold part with your file location
var name = player.GetVar("TextEntry");
var email = player.GetVar("TextEntry1");
s.WriteLine("Email: " + email);
s.WriteLine("Name: " + name);
s.WriteLine("==========");
s.Close();
For the score part, personnaly, I create by myself all the variables for result. If I got a quiz, I set a trigger on the Continue button of the feedback layer to modify my result variable.
Once this done, you can do whatever you want with this variable:
- Get it in a text file with the code upside,
- Call it on a slide or a text box or any objet with text and making it appearing at the start of the timeline,
- Or whatever you want! It's a variable, you can call it back as you want!
Hope iut can help you!
Mike Bethany, I see you said, you would assign the results variable. But how? I made an Adjust Variable trigger, the variable is Answers ( something i made up ), operator is = Assignment ( pretty sure that's right ), the value is Variable ( also I'm pretty sure that's right ), and the value I have is Results from my Results page. Their variable, not mine.
But when I do player.GetVar('Answers').. I would expect a hash or some sort of integer representing the results. Instead I get the string "ScorePoints".. What am I missing here? I can't actually assign as a variable Results.ScorePoints.
Cedric FROEHLICH
me revoilà j' ai un formulaire sur storyline et je voudrais le synchroniser avec Excel pour renseigner cette base.
Cedric FROEHLICH
me revoilà j 'ai non sur Formulaire histoire et je voudrais le synchroniseur Avec Excel verser renseigner la base de this.
je fait un support ou le salarié doit remplir un formulaire et renseigner le xl pour faire son bilan carbon
Hi Yves,
It looks like your most recent posts have been in French, which may be why you haven't heard back from Cedric. Although Google Translate generally does a good job - I'm not sure I'm following the French->English translations that it's providing....
I've been trying to implement the solutions outlined in this (and several other) post on the issue of passing quiz results to an LMS but can't seem to get it to work.
I have a course with two paths a learner can choose from. At the end they complete a quiz based on the content they have reviewed. Obviously I can't have two result slides being passed to the LMS and if I use the 'result of results' option it averages the score (so basically divides the score in half as they only complete one of them).
So I have set up a Variable that takes the Result.ScorePoints figure and a Javascript that then passes that variable to the LMS. However, I've been testing this out in a short demo version in SCORM Cloud and it doesn't work :-(
Could someone take a look and see if they can spot the problem? The new variable is getting the Result.ScorePoints OK so it seems to be the Java bit that isn't working.
I managed to track down the issue in this file and thought I'd post here in case anyone else came across the same issue (or this thread).
When copying and pasting the code provided above, you need to change quotation marks to the ones on your keyboard. The ones above are converted into a web format which will stop the java script working.
Its a hard error to spot, but makes all the difference!
Thanks for sharing your finding and solution here with everyone Gill
I tried player.GetVar("Results"); Its returning -- Path did not resolve at : Results
null
I am also getting the error "resolver::resolvePath - Path did not resolve at:..."
My code is
var player = GetPlayer();
var totalNumber = player.GetVar("TotalNumber");
There is definately a total number value in my master. Set when timeline starts.
This discussion is closed. You can start a new discussion or contact Articulate Support.