Question ID Variables in DB
April 7, 2021 12:00 AM
Hi there - is there any way to remove the additional details at the end of the question variable as it is written to the DB? We have two languages of our content - English / French - and I'd like to make it super easy for my training assessment team to do their required data analysis.
For example, when they export the data from the DB, the Question ID reports: Question_0001_85739, where 85739 appears to be arbitray (see sample screenshot below from our quick analysis.
Solution
To remove the unique identifier (the object id) from the question name when reporting interactions [and rely only on question name] you can add the following to your project:
(the "Append timestamp" publish option for interactions must be unchecked)
Add an On Show -> Run JavaScript action to your Test.
Put in this code:
var TQPr = (findTitleMgrFrame() || myTop).TQPr;
if (TQPr)
{
if (!myTop.origHandleInteractions)
{
myTop.origHandleInteractions = TQPr.handleInteractions;
TQPr.handleInteractions = function() {
var id = this.id;
this.id = "";
try {
var ret = myTop.origHandleInteractions.apply(this, arguments);
} finally {
this.id = id;
}
return ret;
}
}
}
Discussion (8)
Hi sorry I'm not sure what the Scenario is. How is the data being submitted? Is this standard SCORM interaction data? What do the SCORM publish setting look like?
Good morning @wheels .
This is the standard SCORM output to the LMS DB. When we create a new assessment tool, the data gets written to the LMS without a problem; however, the unique ID (cmi.interactions.n.id) of the data entry gets the appended digits at the end of the entry. I think it has something to do in the trivantis_titlemgr_interact.js; however without time to tinker, I cannot provide much more details.
I thought this may have been something known in the application, but if it isn't I will have to go dig later on when I have a chance. Not to worry if not.
I've added screenshots below of all my settings. If these don't help in anyway, I will create a dummy file that produces the same error.
I have it unchecked at the moment, I will check it and uncheck it again to see what happens and will report back once I do.
In your example Question_1_198096 the 198096 value is the internal id of the question object. It is used to ensure uniqueness. This is so Question_1_198096 and Question_1_62451 are not seen as the same question, since they are different questions. Is your use case that you want them to be recorded as if they are the same question?
To remove the unique identifier (the object id) from the question name when reporting interactions [and rely only on question name] you can add the following to your project:
(the "Append timestamp" publish option for interactions must be unchecked)
Add an On Show -> Run JavaScript action to your Test.
Put in this code:
var TQPr = (findTitleMgrFrame() || myTop).TQPr;
if (TQPr)
{
if (!myTop.origHandleInteractions)
{
myTop.origHandleInteractions = TQPr.handleInteractions;
TQPr.handleInteractions = function() {
var id = this.id;
this.id = "";
try {
var ret = myTop.origHandleInteractions.apply(this, arguments);
} finally {
this.id = id;
}
return ret;
}
}
}
We have 2 separate languages - English and French - which are taken based on the user's language profile in the LMS. So in my situation....
- Question_1_198096 comes from the FR version of the module.
- Question_1_62451 comes from the EN version of the module.
Do you know which JS file and line i can go edit to remove the unique identifier? I know this makes it possible that there could be two Question_1's that get submitted, but that's also a situation we'll have to monitor and account for.