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!