Functions in Hype xAPI
hypeDocument
hypeDocument.setCustomDataVariable
2min
the hypedocument setcustomdatavariable function is used to store custom data variables that can be used in the lrs notation the function takes two parameters the key of the custom data variable, and the value to be stored the value can be either a string, number, or boolean if the value is a string, it will be stored as is if the value is a number, it will be stored as a floating point number if the value is a boolean, it will be stored as either true or false an example of using the hypedocument setcustomdatavariable function would be as follows hypedocument setcustomdatavariable("userid", "user123456"); hypedocument setcustomdatavariable("userage", "21"); hypedocument setcustomdatavariable("userisregistered", "true"); in this example, we are setting three custom data variables userid , userage , and userisregistered the userid variable is being set to a string value of "user123456" , the userage variable is being set to a number value of 21 , and the userisregistered variable is being set to a boolean value of true hence, be aware that there is some variable casting going on when using the hypedocuemt etcustomdatavariable function this function exists to provide the gui version and mirror the functionality in code if you mainly use hype custom data you can also use hypedocument customdata directly hypedocument customdata userid = "user123456"; hypedocument customdata userage = 21; hypedocument customdata userisregistered = true;