cmi.interactions.n.id -- what to use for ID?

1,510 views
Skip to first unread message

cmay

unread,
Aug 10, 2010, 2:00:26 PM8/10/10
to eLearning Technology and Development
What is the correct format for the value of cmi.interactions.n.id?

I am trying to set it to a number, and that does not work, the LMS
says that an incorrect data type was specified for the given event.

If I try to set it to "question4," the LMS does not return an error,
but the value appears to be simply "question".

The LMS we are using is Pathlore by SumTotal.

Thanks!

John Campbell

unread,
Aug 10, 2010, 3:21:53 PM8/10/10
to elearning-technolo...@googlegroups.com
The data type is URI which probably can't start with a number or at
least just be one. I have just set it to things like int-0, int-1,
... and haven't had issues. I think the idea though is that you use
some handle format like urn:foo.bar.1 or something.

jpc

> --
> You received this message because you are subscribed to the Google Groups "eLearning Technology and Development" group.
> To post to this group, send email to elearning-technolo...@googlegroups.com.
> To unsubscribe from this group, send email to elearning-technology-and...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/elearning-technology-and-development?hl=en.
>
>

--
John Campbell
(713) 364-4323

Philip Hutchison

unread,
Aug 10, 2010, 3:22:28 PM8/10/10
to elearning-technolo...@googlegroups.com
It should be a string (up to 4000 characters in length with SCORM 2004 or up to 255 characters in length with SCORM 1.2).

"question4" is a valid string for IDs, unless Pathlore has some other criteria.

The official recommendation in the SCORM 2004 docs is to use a URN format:

Form SCORM 2004 documentation:
long_identifier_type: The long_identifier_type represents a label or identifier. This
label or identifier shall be unique within the context of the SCO. The long_identifier_type shall be a characterstring that conforms to the syntax defined for Universal Resource Identifiers (URI), refer to RFC 3986 [6]. SCORM recommends that the URI be a globally unique identifier in the form of a Uniform Resource Name (URN), refer to RFC 2141 [3].
All URNs are required to have the following syntax (phrases in quotes are required):
<URN> ::= “urn:”<NID>“:”<NSS>
where <NID> is the Namespace Identifier and <NSS> is the Namespace Specific String
[3].
Example: urn:ADL:interaction-id-0001
Since an empty characterstring does not provide sufficient semantic information to
uniquely identify a value, then a long_identifier_type value shall not be an empty
characterstring and cannot contain all white space characters. The long_identifier_type
value shall be implemented with an SPM of 4000 characters.


SCORM 1.2 doesn't specify a preferred format, but simply states the ID should be a string, much like the one you're using.

Note that cmi.interactions.n.id is not a required element in SCORM 1.2 and some LMSs may not support it.

- philip


cmay

unread,
Aug 11, 2010, 11:58:45 AM8/11/10
to eLearning Technology and Development
I think my problem is with Flash, not the LMS...

I am using the PIPwerks framework for SCORM 1.2

My var is qID, which is pulled from an XML object. That makes it a
String automatically.


The first line reads in the same data and assigns it to var qID
var qID="question"+String(questionObject.qData.qID.text());

So when I do this trace on the next line, I get a value, usually an
number 1, 2, 3 etc
trace("qID="+qID);

The third line then submits the data:
var idResult=scorm.set("cmi.interactions."+qNum+".id",qID);

Even though we just traced the value in the line before, the LMS
throws an error saying it did not receive a value for
cmi.interactions.id.
If I concatenate qID with a string ---> qID="question"+qID, the LMS is
happy, but all that gets written is "question" I am still missing the
qID part.

Any Ideas? I am stumped...

Philip Hutchison

unread,
Aug 11, 2010, 12:54:16 PM8/11/10
to elearning-technolo...@googlegroups.com
There's no string manipulation going on in the SCORM wrapper(s), so they should be passing your data as-is to the LMS. That leaves two possibilities: the ActionScript code and the LMS.  I've never heard of an LMS truncating short ID strings.

When you trace your concatenated qID string (before sending to the LMS), does it return the correct value?

Also, perhaps your qNum is the problem: if the error states "did not receive a value for
cmi.interactions.id", it's not showing an interaction number before the ".id" portion. Did qNum get inserted correctly? If so, the LMS should say "cmi.interactions.n.id" (with n being replaced by your ID number).

For testing purposes, I'd try setting it up like this:

var qNum = questionObject.qData.qID.text() || false;
trace("qNum: " +qNum);

if(qNum){

var qID = "question" + qNum;
trace("qID: " +qID);

var cmi = "cmi.interactions." + qNum + ".id";
trace("cmi: " +cmi);

var idResult = scorm.set(cmi, qID);
trace("scorm.set successful? " +idResult);

}





--

Ridgie Barton

unread,
Aug 11, 2010, 1:09:18 PM8/11/10
to elearning-technolo...@googlegroups.com
We ran into an LMS - implementation of Docent that did not handle certain characters when we used JSON. Made a test page and posted data until we figured out what it did not like then - filtered that character out - we were getting truncated strings before we located the offending character.

Ridgie Barton
Principal

Office: 949.250.1749 x218
Direct: 949.419.2568


cmay

unread,
Aug 13, 2010, 1:06:01 PM8/13/10
to eLearning Technology and Development

Phillip -

qNum is not the problem. I can see it in the trace from the LMS. As I
move thru the questions, it is being incremented properly.

*********************LMS Trace - trying to set .id
**************************************************

Detail: LMSSetValue(cmi.interactions.1.id,) <-- see no
value passed to LMS!!!!!!
Event Description:
--------------------------------------------------------------------------------
Indicates that the LMSSetValue API was called. This event contains
information about the value specified.

*********************LMS Trace - error thrown when trying to set .id
**************************************************

Detail: SetInteractionsValue value is incorrect size: 0
Event Description:
--------------------------------------------------------------------------------
Indicates that an incorrect data type was specified for the given
event.

Philip Hutchison

unread,
Aug 13, 2010, 2:15:05 PM8/13/10
to elearning-technolo...@googlegroups.com
i don't see any trace for

 
var qID = "question" + qNum;
trace("qID: " +qID);

as i mentioned in my previous email, i'm wondering if the qID string is valid before it goes to the LMS.





--

Estes Ethan

unread,
Aug 13, 2010, 2:20:33 PM8/13/10
to elearning-technolo...@googlegroups.com
I'm guessing that the concatenation code is creating something other than type=string and the API is kicking it back. Best to make a temp variable for the complete ID value then use that variable when you call the set value. Doing it dynamically in line with the set call may be blowing up your code.

-EÆ


Philip Hutchison

unread,
Aug 13, 2010, 2:30:02 PM8/13/10
to elearning-technolo...@googlegroups.com
that's my suspicion as well.

if you want to be very cautious you could do something like:

var idResult:Boolean = false;
var qID:String = (typeof qNum !== "undefined") ? "question" + qNum : "badmamajama";

if(qID !== "badmamajama"){
   idResult = scorm.set(cmi, qID);

Philip Hutchison

unread,
Aug 13, 2010, 2:37:40 PM8/13/10
to elearning-technolo...@googlegroups.com
actually a super-duper cautious route would be more like

var idResult:Boolean = false;
var qNum:String = questionObject.qData.qID.text() || "";
var qID:String = (qNum !== "") ? "question" + qNum : "badmamajama";


if(qID !== "badmamajama"){
   idResult = scorm.set(cmi, qID);
}

the main idea being that you're using strict data typing, and that you have a string fallback  ("") for questionObject.qData.qID.text() if it returns null for some reason.

you then have a secondary check to ensure the id is valid (ie not 'badmamajama") before trying to send everything to the LMS.

- philip

Estes Ethan

unread,
Aug 13, 2010, 2:53:54 PM8/13/10
to elearning-technolo...@googlegroups.com
Also you could write a typed function that generates the id with parameters fed in and a typed return of string. Add in the typed conversion code in the function that philip included.

public function buildQuestionID(_prefix:String, _num:Number):String{
//_prefix would be "question"
//_num would be the incremented number variable
var  myQuestionID = new String()
//convert and concatenate code goes here with type checks etc

//return the id value
return  myQuestionID
}

When you run it under the debug version of flash player it'll let you know when something is not typed correctly.  

That code was not tested so it may not be strictly valid.

-EÆ


cmay

unread,
Aug 13, 2010, 3:23:54 PM8/13/10
to eLearning Technology and Development
You were both correct. The concatenation in Flash was doing some weird
stuff. Every time I traced the var in Flash, it would return the
correct value. When I tried to trace it from the javascript side of
things I always got a null.

The weird thing is that qID was a string to begin with... The value is
an interger, but when read from XML that is supposed to come in as a
string.

the solution was this:

var questionID:String=String(Number(qID));
var cmi="cmi.interactions."+qNum+".id";
var idResult=scorm.set(cmi, questionID);

I don't know why I had to typecast to number then to string, but it
works!

Thanks for all your input!
Reply all
Reply to author
Forward
0 new messages