Hi, Folks
We have conceived a captivate project (Captivate 2017) in which learners get the opportunity to train their ability to figure out the exact prices of different packages of our product.
With 8 given package constellations in the shopping cart the learner is asked to type in what she/he assumes as the correct price. Using an advanced action and variables after entering the learne’s input will be displayed, the correct price (i.e. the right answer), and the difference is calculated. ( 1. “Your price enty” / 2. “correct prince” / 3. “You charged xx.xx Euro too much / too little” )
Our variable is as follows:
print out:
v_difference – v_correct_price – v_customer_x_input
With the learner’s input of smooth amounts everything works fine. But if the learner enters a price that is by (let’s say) 20 cents too much or too little the calculated and displayed difference s a very weird result:
Instead of “You charged 0.20 Euros too much” it says “You charged 0.2999999999999999716 too much ”
As it is all a matter of adding or subtract amounts and nothing is divided or so these odd figures are very strange and we have no guess where the problem stems from.
(We have already considered a workaround using a java script that would round thw calculated difference to only two digits behind the decimal mark (decimal separator). But there must be another solution to this issue.
Any qualified suggestions will be very much appreciated.
Thanks in advance
Tom
Hallo, Lieve
I am so sorry. Being an absolute beginner with Captivate and also new to the community when I could not find my question (most probately looking at the wrong place) I thought something had gone wrong with my question and posted it another way. Thank you very much indeed for your reply.
Tom
Understood. The problem is indeed IN this portal. There has been no moderation between 3 July and yesterday afternoon. I have a blog waiting for moderation, only some questions including yours have been accepted. You didn’t get any indication that a comment was posted to your question (which I have done very quickly after it appeared). You have to search yourself in the Discussions. Come to the portal to find information, projects, blogs but not for questions.
At this moment I can only recommend to post questions in the Adobe forums, where moderation is 24/7 and more helpful Captivate users from all over the world are present to help you within hours. As a moderator on that forum I try to look out for questions which don’t get an answer. That may be due to the question not fully clarified, in which case I will try to help you with detail questions.
Sincerely hope you will be able to understand what I wrote in that blog post about formatting numbers. More info about the JS API for Captivate can be found here:
https://helpx.adobe.com/captivate/using/common-js-interface.html
To format numbers you need to use JavaScript. You find an example (scroll to the end of the post) in this blog:
http://blog.lilybiri.com/percentage-progress-indicator-non-linear-course-solution-2
This is due to the fact that CP is not really differentiating between strings and numbers… hope this will change in the future.
You must be logged in to post a comment.