Skip to main content
KariMueller
Inspiring
February 1, 2016
Answered

Get student FIRST name only from LMS to display in CP9 Scorm course?

  • February 1, 2016
  • 1 reply
  • 1167 views

Has anyone had luck getting the first name only to display in CP9. I'm not sure if I am doing something wrong or if it's just not possible.

I found this link and tried this method. When I downloaded the project included on the link and uploaded this into my LMS, it worked. The name displayed.

Display the Student's Name From Your LMS Using Adobe Captivate 6.x - CaptivateDev.com

However, when I tried to replicate the results in another project by coping and pasting the javascript to the slide on enter and creating the variable studentname with no luck.

I also tried the built in variable in CP9: cpQuizInfoStudentName, but this displays the Last name, First name and we would link only the first name.

Any help is appreciated.


Thanks

This topic has been closed for replies.
Correct answer KariMueller

Hey Rod, Thanks for the reply. I posted the same question in another part of the forum and was able to get the javascript code. Its all good now.

In case anyone finds this thread down the line and would like the answer, here it is:

I created the variable v_FirstName

Then I inserted that variable on the slide then applied the javascript to slide enter:


var getName = window.cpAPIInterface.getVariableValue( "cpQuizInfoStudentName" );

  

var newName = getName.split(",");

      newName .reverse();

  window.cpAPIInterface.setVariableValue('v_FirstName', newName[0]);



1 reply

RodWard
Community Expert
Community Expert
February 2, 2016

As you have found, the cpQuizInfoStudentName variable can pick up the student name from the LMS at run-time, however, the format in many cases will be lastName, firstName rather than the other way round.

If you have some JavaScripting skills you can split the value at the comma in the middle and save each part to a different user variable of your own creation.  Then you can use the first name as you wish.

I believe this issue has come up before on this forum and someone supplied the JavaScript code that could be used. I suggest you search for that.

KariMueller
KariMuellerAuthorCorrect answer
Inspiring
February 2, 2016

Hey Rod, Thanks for the reply. I posted the same question in another part of the forum and was able to get the javascript code. Its all good now.

In case anyone finds this thread down the line and would like the answer, here it is:

I created the variable v_FirstName

Then I inserted that variable on the slide then applied the javascript to slide enter:


var getName = window.cpAPIInterface.getVariableValue( "cpQuizInfoStudentName" );

  

var newName = getName.split(",");

      newName .reverse();

  window.cpAPIInterface.setVariableValue('v_FirstName', newName[0]);