user
@jpshapir
How to import data into storyline
Hello! I'm a different user than the one the original thread was for.
I want to have a google sheet in which users' storyline answers are stored. When the user clicks "submit", I want user A's answer to be stored in the google sheet, and also to have two of the answers from other users to appear in user A's storyline course for viewing. It's a means of building community and evaluating other people's examples.
How do I do this? I found a tutorial on this site for how to get data from Storyline to Google Sheets. How do you get it to go the other way? And how might I get it to select an entry that will serve the purposes of the course? Random entries could work, or the last two entries before the current user's.
Thank you for your support. I'm a loyal Cluelabs user at this point.
reply
Reply
user
@support
Hello,

To read the data from a different row in a Sheet, just update the variable stencilsheetstoken to the number of the needed row and then use SheetsGet(...) to get the data from that row.

To return to the current user's row, change the stencilsheetstoken back to its original value.

If you need random rows, one way to go is use JavaScript to generate two random numbers that are lower than the current value of the stencilsheetstoken variable. Then use these numbers to get the data from those rows.
reply
Reply
user
@jpshapir
I appreciate your help. Thank you! I will try it.
reply
Reply
user
@jpshapir
Hi. I tried this.

I don't see how to get the variable stencilsheetstoken, the variable that remembers the row that it grabs the sheets data from, to change the way I want it to. It's a text variable not a number variable. So how do I get it to change using javascript to two random numbers that are lower than the current user's value?

And where, in all this, would I put in a javascript random-number-within-a-certain-range code, provided ChatGPT and I can agree on some code to try?

Thank you again!
reply
Reply
user
@support
Hello. These are JavaScript questions, not Cluelabs questions, but I'll do my best to answer.

"It's a text variable not a number variable."
- There is a JavaScript function parseInt that can convert text to a number.

"How do I get it to change using javascript."
- You can look up Storyline JS functions SetVar() and GetVar().

"Two random numbers that are lower than the current user's value."
- One way to do it is use the JavaScript Math.random() function.
reply
Reply
user
@jpshapir
I appreciate it. Thank you!
reply
Reply