Storyline 360: Load variable values from external file on course launch

Mar 27, 2020

Is there a way to load values into variables on course launch from an external file, such as XML, CSV, or something similar? I have a bunch (60 or so) variables that need to get populated with content. Right now I have text entry fields for all of them and the user has to type them in, which is time-consuming. It also doesn't allow for doing the same things twice because at best it's copy/paste each variable, one at a time, from a spreadsheet or something into Storyline. I'd love to find a way to store those in a file that can be edited and prepared ahead of time that Storyline reads on launch to load the values. Any ideas?

9 Replies
Russell Killips

Hello Dave,

You won't be able to do this automatically on course launch. There is web browser security in place preventing direct access to the users file system.

What you can do, is provide a Browse button that the user can click on. Then they can choose the XML file. After choosing the XML file the values will be read into the Storyline variables.

Take a look at this sample project.

It has WebObject. This WebObject has one file in it called index.html. This WebObject reads the values from the XML and loads them into the Storyline variables. You can make changes to the code by opening this file in Notepad. Currently it only reads 3 variables. You will need to edit it to add in more. Below is a screen shot of the code inside of index.html

WebObjectCode

You will also need to add more variables to the xml. You can also edit this in notepad.

xmlCode

Dave LeFevre

Russell, is there a limit to the number of variables you can use or something? I can't seem to get it to load more than five, even though the syntax and everything looks good. Are there certain characters that can't be used (like underscore _)? Are there certain words that don't work for variable names? Can't seem to get past loading only five items, no matter what I try, and I need almost 40 to load with this method. All text variables as you can see in the attached. I've tried many different names and such but it only loads the first five and stops.

Dave LeFevre

You are correct; in my copy/pasting of the version I uploaded, I had Team5 twice. But even changing it to Team6 doesn't fix the problem--it only loads the first five variables. Does it work for you? I've tried up to 20 variables, with different names and values, and seem to be stuck with this problem no matter what I do. Appreciate any help you can offer. I have a way to let the person manually input all the variables but this would be so much easier I'd love to figure it out.

Dave LeFevre

Russell, I see the problem, based on your comment. I was not deleting and adding back in the web object when I changed it. I thought it was updating in Storyline when I published, but I see now that it updates when you embed the web object on the page itself. I haven't finished the project yet but from the testing I just did, that seems to address the issue I was seeing (which makes perfect sense once you said that). So I think I'm good to go--thank you VERY MUCH for your help with this!

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