Rounding of Referenced Numeric Variables Upon Module Resume (Case #02492198)

Oct 22, 2020

Hi Everyone,

I am currently running a chemistry laboratory experiment through a Storyline 360 module which contains many numeric variable entries to collect experimental data. Students enter their numeric values (for instance 29.485) and then the numeric variable is called later through a reference in the experiment to summarize their results in a data table. This all works beautifully, all digits are recorded as entered and then output into the table. No data is rounded.

Here's where things have become interesting, similar to the report (01899822), when a student leaves, comes back and resumes the module some values are truncated/rounded.

The values that students entered directly into the numeric entry fields, retain their original state (so 29.485 stays that way) BUT when we go to the summary table for the referenced of the numeric variable (%numericEntry1% for instance), the number is truncated (29.49).

This is somewhat problematic for the resume to behave this way for our particular course since significant figures are one of the learning outcomes being tested when students take their data outside of the module....so it is unfortunate that this truncation happens for folks that resume the module.

Perhaps (and it's my hope) I am missing something incredibly obvious with respect to printing the values of a numeric variable entry elsewhere in the module.  Looking for advise/feedback from the Heroes Community!

I'm going to explore simply going the text entry route for the next experiment module build that releases in a few weeks (to 1200 students) and I can count on my text not being rounded on resume :) But would definitely prefer to find a resolution for the use of numeric entry in this case to ensure calculation features are still available to us in the module builds.

Cheers,

Jenn

5 Replies
Math Notermans

This might help....

Use javascript to save the multi-digit input to a temporary variable...
Then you can convert that to a number with any amount of digits anytime for calculation and showing it properly on resume of the course... Like this...

var player = GetPlayer();
var valueEntered = player.GetVar("NumericEntry");
player.SetVar("storedStringVar",valueEntered);

Using a textfield with %storedStringVar% to show the result...
Sample attached...

And if you need help working it out in a real case let me know and i help...

Kind regards,
Math

Jennifer MacDonald

Hi Math,

Thanks for this really neat solution! I am definitely going to file this approach in my toolbox for future builds in the event that my parallel inquire through the case procedure doesn't turn up a fix more globally (#02492198). The stroke of good luck here is the next build doesn't require me to do math with the data entered, so I might be able to simply get away with text based entry for now (the module has over 100 variables to collect and report student experimental data...so it might become really interesting to apply the Javascript to all of those).

If I am interpreting all this correctly, I would indeed need to use Javascript to convince the text Entry to accept only numeric digits...and then do all this Javascript magic to convince the output to remain with the full number of decimal places when the variable is referenced on resume.

Thanks again Math! I really appreciate your feedback on this challenge!

Jenn

 

 

 

Math Notermans

Actually no need to use a text-entry as input.... only to show the number with decimals.
As you can see in my sample it uses a normal Numeric Entry... when entering a value into the Numeric Entry input field...javascript gets triggered that passes the internal variable NumericEntry to a custom Javascript variable.
The 2 textfields with inline variable (%storedNumVar% and %storedStringVar%) show what Storyline does with the NumericEntry ( it rounds decimals to 2 ) and the nonrounded Javascript variable that is created from the value of the NumericEntry.

Gonna make a full sample of this for this weeks Challenge: 'How are Course Designers Using Number Variables in E-Learning #301'

And maybe add a trick into it how to apply Javascript to +100 variables ;-) If i can imagine one...

Kind regards,
Math

Math Notermans

Applying Javascript to multiple Numeric Inputfields ( or any element actually ) is not that hard.
A simple Javascript loop does the job. Like this one...

var player = GetPlayer();
var amountOfVars = 5;

for(var i = 1; i < amountOfVars+1;i++){
var value = player.GetVar("NumericEntry"+i)
player.SetVar("someVar00"+i,value);
}

Luckily Storyline numbers input elements and their corresponding variable sequentially when creating them.. the same counts for copying and pasting those elements. What i didnot try is getting the onscreen amount of Numeric Entries from Storyline itself. Also i dont have a solution (yet) for a case where you might have input fields with different names... and not nicely named sequentially.. Sure thats possible too and gonna give that a try too.

Sample added...

This discussion is closed. You can start a new discussion or contact Articulate Support.