Saving data with triggers in Articulate Storyline examples

Can you provide examples of saving data with triggers in Articulate Storyline?

July 22, 2019, 6:18 pm

Click for thumbs down.0Click for thumbs up.2#1

Example 1.

I set up a field called “status” and want to set it to either “pass” or “fail” depending on the situation.

I will create a JavaScript trigger with the following code to set the status to “pass”:

CloudSet('status', 'pass');

And the following JavaScript trigger to set the status to “fail”:

CloudSet('status', 'fail');

I will use conditional triggers in Storyline to run the script:

Example 2.

I want to track whether the learner answered the question correctly.

I set up a field called “quiz” and want to use values “correct” or “incorrect” depending on the answer provided.

I will add this JavaScript trigger to execute when the timeline of the Correct layer starts:

CloudSet('quiz', 'correct');

And this JavaScript trigger on the Incorrect layer:

CloudSet('quiz', 'incorrect');

Example 3.

I want to save the response entered by the learner in the module.

I set up a field called “reflection” in the data table.

In Storyline, I will add a text entry box for the learner to type their response:

Then I will add the following trigger when the Submit button is clicked:

var player = GetPlayer();

var entry = player.GetVar("TextEntry1");

CloudSet('reflection', entry);

 

 

July 22, 2019, 6:25 pm

Click for thumbs down.0Click for thumbs up.3#2

Great looking set of widgets! I am new to this but getting there.

A question about Example 3 where the content of a text entry variable is saved; can I also use this method to save the content of a numeric variable?

John.a.

March 6, 2020, 6:15 pm

Click for thumbs down.0Click for thumbs up.0#3

Hi John. You should be able to, I don't see why not.

March 6, 2020, 9:06 pm

Click for thumbs down.0Click for thumbs up.0#4

Is there a way to record multiple text entry fields with a single submit button?

April 2, 2020, 12:47 pm

Click for thumbs down.0Click for thumbs up.0#5

I have successfully saved some data from storyline variables following example 3 above.
Saving numeric variables works some of the time - for example the content of a variable that holds a storyline slider or dial value - Just for information I have found that if you set a slider or dial to set the variable value w'hen the user releases' it works but if you set it to adjust the variable 'whilst the slider is being dragged' it doesn't work.

However I would like to store the value of a storyline built-in variable: 'Menu.SlidesViewed'. This is numeric I believe.
At present I have a JavaScript trigger to store this from the master slide (all slides in the project use the same master). What is being returned at the moment is the value of zero. I wonder if I can do this or I'm going about it the right way?

Thanks
John.a.

May 28, 2020, 10:53 am

Click for thumbs down.0Click for thumbs up.0#6

John, according to this page: https://articulate.com/support/article/accessing-system-variables-in-articulate-storyline-javascript-triggers "Storyline isn't currently designed to expose system variables for user interaction."

May 28, 2020, 12:13 pm

Click for thumbs down.0Click for thumbs up.0#7

Is there a way to save test score in Articulate via Stencil?

June 3, 2020, 9:18 pm

Click for thumbs down.0Click for thumbs up.0#8

Is there a way to save test score in Articulate via Stencil?

June 3, 2020, 9:19 pm

Click for thumbs down.0Click for thumbs up.0#9

Is there a way to save test score in Articulate via Stencil?

June 3, 2020, 9:20 pm

Click for thumbs down.0Click for thumbs up.0#10

@johnhambrcluelabssupport I am struggling mightily to get any data at all collected from my Storyline file and reflecting in my data table using the widget instructions. All I want to do is capture a True False variable. So when a user starts on the first slide of my Storyline course, it sends 'True' to my Data Cloud table. How do I do this? I've followed the instructions when creating a new data table, but it's not working for me at all.

Once I know it works for my needs, I then need to collect slightly more complex data, e.g. when a user clicks on a download link, this data needs to be collected. And what option a user selects from a multiple choice question. Thus far, however, I can't get anything out of my Storyline file – either when I publish and run it locally, or when I upload it to my LMS (Matrix). Please advise.

August 3, 2020, 4:24 pm

Click for thumbs down.0Click for thumbs up.0#11

@johnhambrcluelabssupport I am struggling mightily to get any data at all collected from my Storyline file and reflecting in my data table using the widget instructions. All I want to do is capture a True False variable. So when a user starts on the first slide of my Storyline course, it sends 'True' to my Data Cloud table. How do I do this? I've followed the instructions when creating a new data table, but it's not working for me at all.

Once I know it works for my needs, I then need to collect slightly more complex data, e.g. when a user clicks on a download link, this data needs to be collected. And what option a user selects from a multiple choice question. Thus far, however, I can't get anything out of my Storyline file – either when I publish and run it locally, or when I upload it to my LMS (Matrix). Please advise.

August 3, 2020, 4:24 pm

Click for thumbs down.0Click for thumbs up.1#12

Hello. If you followed the how-to instructions and the widget is initiated properly, this code will set the value to true:

CloudSet('field', 'true'); //replace field with the name of the field you defined in the table

August 3, 2020, 4:29 pm

Click for thumbs down.0Click for thumbs up.0#13

@johnhambrcluelabssupport Thanks for coming back to me so quickly. I did this, but no data is pulling through to the table at all. Will it pull through only if it is published and hosted online (e.g. on an LMS), or can I test it by running it locally on my PC?

Also, the two Execute Javascript triggers I've created are on the opening slide of the course. Is this all right? (The instructions talk about 'the main Master Slide in your course').

August 3, 2020, 4:34 pm

Click for thumbs down.0Click for thumbs up.0#14

@johnhambrcluelabssupport I guess I'm not initiating the widget properly, John, but I can't tell what I've done wrong based on the instructions provided. In the example I cited, I guess when I create a new data table, I fill in the Field Name, and then make the Field Type True/False – correct? Do I leave the default value field blank? I then created the blank text variable 'stencilusertoken' in my Storyline file, created an Execute Javascript trigger and pasted in that long script. Then I created another to Execute the CloudSet script, making the necessary change to the 'field' section. What am I missing?

August 3, 2020, 4:49 pm

Click for thumbs down.0Click for thumbs up.0#15

Hi-
Following up on example #3 above, what would the code look like when sending the values of 5 text fields to the cloud?
I'm trying this, but all I get is the 5th value saved to the cloud.

var player = GetPlayer();
var entry1 = player.GetVar("WS1");
var entry2 = player.GetVar("WS2");
var entry3 = player.GetVar("WS3");
var entry4 = player.GetVar("WS4");
var entry5 = player.GetVar("WS5");

CloudSet('supplies the goods/services', entry1);
CloudSet('supplies the goods/services', entry2);
CloudSet('supplies the goods/services', entry3);
CloudSet('supplies the goods/services', entry4);
CloudSet('supplies the goods/services', entry5);

October 12, 2020, 9:48 pm

Click for thumbs down.0Click for thumbs up.0#16

Hi-
Following up on example #3 above, what would the code look like when sending the values of 5 text fields to the cloud?
I'm trying this, but all I get is the 5th value saved to the cloud.

var player = GetPlayer();
var entry1 = player.GetVar("WS1");
var entry2 = player.GetVar("WS2");
var entry3 = player.GetVar("WS3");
var entry4 = player.GetVar("WS4");
var entry5 = player.GetVar("WS5");

CloudSet('supplies the goods/services', entry1);
CloudSet('supplies the goods/services', entry2);
CloudSet('supplies the goods/services', entry3);
CloudSet('supplies the goods/services', entry4);
CloudSet('supplies the goods/services', entry5);

October 12, 2020, 9:48 pm

Click for thumbs down.0Click for thumbs up.0#17

Actually, I've got 99% of this working. There is just one field (CloudSet('what', entry16);) that does not populate. I've gone over all of my variables in SL, as well as the javascript that loads when the Submit button is clicked, but can't see where the problem is.
Would you have any tips for me?
Thanks-Jim

var player = GetPlayer();

var entry1 = player.GetVar("WS1");
var entry2 = player.GetVar("WS2");
var entry3 = player.GetVar("WS3");
var entry4 = player.GetVar("WS4");
var entry5 = player.GetVar("WS5");
var entry6 = player.GetVar("R1");
var entry7 = player.GetVar("R2");
var entry8 = player.GetVar("R3");
var entry9 = player.GetVar("R4");
var entry10 = player.GetVar("R5");
var entry11 = player.GetVar("SS1");
var entry12 = player.GetVar("SS2");
var entry13 = player.GetVar("SS3");
var entry14 = player.GetVar("SS4");
var entry15 = player.GetVar("SS5");
var entry16 = player.GetVar("What1");
var entry17 = player.GetVar("What2");
var entry18 = player.GetVar("What3");
var entry19 = player.GetVar("What4");
var entry20 = player.GetVar("What5");
var entry21 = player.GetVar("Who1");
var entry22 = player.GetVar("Who2");
var entry23 = player.GetVar("Who3");
var entry24 = player.GetVar("Who4");
var entry25 = player.GetVar("Who5");
var entry26 = player.GetVar("Name");

CloudSet('supplies', entry1);
CloudSet('supplies1', entry2);
CloudSet('supplies2', entry3);
CloudSet('supplies3', entry4);
CloudSet('supplies4', entry5);
CloudSet('resources', entry6);
CloudSet('resources1', entry7);
CloudSet('resources2', entry8);
CloudSet('resources3', entry9);
CloudSet('resources4', entry10);
CloudSet('start', entry11);
CloudSet('start1', entry12);
CloudSet('start2', entry13);
CloudSet('start3', entry14);
CloudSet('start4', entry15);
CloudSet('what', entry16);
CloudSet('what1', entry17);
CloudSet('what2', entry18);
CloudSet('what3', entry19);
CloudSet('what4', entry20);
CloudSet('who', entry21);
CloudSet('who1', entry22);
CloudSet('who2', entry23);
CloudSet('who3', entry24);
CloudSet('who4', entry25);
CloudSet('name', entry26);

October 13, 2020, 1:09 pm

Click for thumbs down.0Click for thumbs up.0#18