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

Displaying Variables with Decimal places

New Here ,
Sep 12, 2018 Sep 12, 2018

Copy link to clipboard

Copied

Hello,

I have been searching for a solution to this and cannot find one. I am creating a software training and have to load in some variables naturally. I needed some random numbers, so I decided I would initialize all of my variable in JavaScript. Having a programming background I passed a variable OD_SPH as a string from JavaScript to Captivate. Sampled below.

var OD_SPH = "-3.00";

window.cpAPIInterface.setVariableValue("OD_SPH", OD_SPH);

When I attempt to display in captivate it converts this to -3 on display when I need it to show the trailing zeros. I've confirmed that JavaScript is capturing this as a string, but it would seem that captivate is converting this to an integer. Does anyone have any ideas on how to get this to display properly?

Thank you in advance,

Jacob Strand

TOPICS
Advanced

Views

297

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

correct answers 1 Correct answer

People's Champ , Sep 17, 2018 Sep 17, 2018

If this is HTML5 only, just use:

window.OD_SPH = "-3.00";

If you use the cpAPIInterface.setVariableValue, Captivate does run it through a function (cp.ho) to convert a string.

Votes

Translate

Translate
People's Champ ,
Sep 17, 2018 Sep 17, 2018

Copy link to clipboard

Copied

LATEST

If this is HTML5 only, just use:

window.OD_SPH = "-3.00";

If you use the cpAPIInterface.setVariableValue, Captivate does run it through a function (cp.ho) to convert a string.

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