Forum Discussion

RemcoSchoos's avatar
RemcoSchoos
Community Member
3 years ago

How can I use Storyline 360 variables in custom xAPI statements as Number (not as String)

Hi,

Perhaps somebody knows this and I miss something obvious :-)

I have a few Storyline360 Number variables.

I am modifying the variable with a Web Object (a little game). 

In the end, storyline is sending a custom xAPI statement to set the score in the LRS. 

But to fill the 'score' in the 'result' node in the xAPI JSON, with 'min', 'max', 'raw' and 'scaled' these values need to be numbers, not strings.

I created a game that sets Storyline Number variables:

  • Window.GetPlayer().SetVar(“gameScoreMin”, 0)
  • Window.GetPlayer().SetVar(“gameScoreMax”, 1600)
  • Window.GetPlayer().SetVar(“gameScoreRaw”, 800)
  • Window.GetPlayer().SetVar(“gameScoreScaled”, 0.5)

In storyline I want to send an xAPI statement with a “result” node containing score information:

“result":{
                "score":{
                        "min":0
                        "max":1600
                        "scaled":0.5
                        "raw":800
                },
}

But Storyline does not allow (note: no quotes around the vars):

“result":{
                "score":{
                        "min": %gameScoreMin%,
                        "max": %gameScoreMax%,
                        "scaled": %gameScoreScaled%,
                        "raw": %gameScoreRaw%
                },
}

I get an error from Storyline "error in path: result.score.scaled" when clicking OK in storyline to save the statement.

Storyline only seems to accept the variables if they are inside a String (quoted):

“result":{
                "score":{
                        "min": “%gameScoreMin%”,
                        "max": “%gameScoreMax%”,
                        "scaled": “%gameScoreScaled%”,
                        "raw": “%gameScoreRaw%”
                },
}

Which results in (quoted values /  Strings):

“result":{
                "score":{
                        "min": “0”,
                        "max": “1600”,
                        "scaled": “0.5”,
                        "raw": “800”
                },
}

But that is not valid xAPI for Learning Locker (LRS) to accept (it sends an 400 error back). It expects Numbers, not Strings.

When I hardcoded all values to numbers (e.g. "raw": 800) all works fine

My question: How do I get a Storyline variable in the xAPI statement as Number in stead of a String?

Thanks!

  • Hi Everyone,

    I have some exciting news to share! We just released another update for Storyline 360. In Update 82, we’ve included important fixes and new features.

    One of the fixes we’ve included is:

    You no longer need to add quotes to variable values in custom xAPI statements.

    To take advantage of this update, launch the Articulate 360 desktop app on your computer and click the Update button next to Storyline 360. You'll find our step-by-step instructions here.

    Please let me know if you need additional help!

  • Any joy with a resolution to this? If not, is there any chance of a more detailed explanation of what exactly to remove as a workaround (with reference to "and related escape characters")?

  • Hi Tom, 

    Thanks for reaching out! We don't have any news to share at this time, but as Kelly mentioned earlier in this thread, we'll be happy to update this discussion when we have any news for you all in the future!

    I'm curious to hear of any workarounds from our talented community members. Have a great start to your week! 

  • RemcoSchoos's avatar
    RemcoSchoos
    Community Member

    Thats great! thanks for the reply.

    For the initial project (the fix took circa 18 months) it's too late, but this sure will be useful for new endeavors.

    Can't wait to see if/when a full API becomes available to enhance/automate Storyline even more from embedded objects...