• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Is it possible to dynamically create a user variable at runtime from within a Widget?

New Here ,
Apr 17, 2012 Apr 17, 2012

Copy link to clipboard

Copied

I'm trying to develop a custom Interactive Widget. This widget will allow the user to take multiple attempts, and needs to store information about previously completed attempts so they can (hopefully) see their improvements over time.

I'm trying to figure out the best way to store the data about the previously completed attempts across multiple sessions in a LMS. It seems that the data stored in user variables is automatically stored/restored in suspend_data, which would be perfect. The issue is that I can't find a way to dynamically create a new user variable from within a Widget. It looks like I can only access user variables that the author has explicitly defined in the Captivate interface. I'd rather not have to force the author to define an empty User Variable that they'll never knowingly use, just to give the Widget a bucket to store its data.

Does anyone have any ideas for what might be the best way to accomplish this? I'd like to stick to standard, "approved" APIs as much as possible, but I'd be willing to bend some rules if necessary.

Thanks!

TOPICS
Advanced

Views

742

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Apr 17, 2012 Apr 17, 2012

Copy link to clipboard

Copied

I'd love to know the answer to this as well.  From what I can gather, the variables created at design time in the Cp UI are dynamically injected into the swf using the CaptivateMainTimeline.as file on swf publish.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 17, 2012 Apr 17, 2012

Copy link to clipboard

Copied

I was afraid it was something like that, Jim. Do you have any advice or approaches to pull off something similar that have worked in the past?

The best response I've heard so far (and I don't love it, but it would theoretically work), is to manually call the SCORM Javascript function that the Captivate html templates define, and store the information in cmi.comments. This would at least avoid any interference with the already-used cmi.suspend_data and cmi.interactions, but still smells bad to me.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Apr 17, 2012 Apr 17, 2012

Copy link to clipboard

Copied

Ryan,

I assume you've asked this question here:

https://groups.google.com/forum/?fromgroups#!topic/elearning-technology-and-development/e5vWZfJ6X8I

I asked a similar question here:

https://groups.google.com/forum/?fromgroups#!searchin/elearning-technology-and-development/leichlite...

Philip gave you sound advice.  You'll have to hijack/re-purpose the comments or the suspend data.  I was successful in using SCORM comments in a Moodle system to store extra data I needed for a customer.  It's not ideal, but it gets the job done. Here's a thread about that:

https://groups.google.com/forum/?fromgroups#!topic/elearning-technology-and-development/YgYAMGfXQNw

If you use suspend data, you have to watch out for a few things:

1.  It's base 64 encoded... so any data you append to what Captivate outputs will need to be in base 64 (that's a good practice anyway since the data has to be serialized).

2.  On course re-entry, you'll need to capture the suspend data before it hits Cp to strip off / read your needed data.  If the suspend data isn't in the format Cp expects, you'll get a nice white screen of death.

Ideally, it would be nice to be able to dynamically create user variables for purposes like this... and it's been requested in Cp 6.... we'll see if it gets added (not holding my breath).  Until then, I'd use cmi.comments.

Jim Leichliter

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 17, 2012 Apr 17, 2012

Copy link to clipboard

Copied

LATEST

Yep, that was me! I just figured I'd check for a second opinion before I cut open the patient.

I had considered hijacking the suspend_data as you suggested, but as you also mentioned it seems like it could be pretty brittle.

Thanks for the advice. I'll give cmi.comments, and thanks for the heads up about Cp6!

-Ryan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources