Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently May 18th, 2024, 6:40 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: round a variable to 1 decimal
PostPosted: February 6th, 2018, 11:12 am 
Offline

Joined: August 5th, 2010, 1:42 pm
Posts: 109
Opus: Creator v9 Opus v7
OS: windows
Back to my previous topic about rounding a number to 1 decimal.
What I need to do is to round a number in a avariable like this:
<(SCORE_CORRECT*10)/SCORE-TOTAL>
what do I have to add to that variable to round it to 1 decimal?
i don't want code, only to complete that variable so it won't show 1,42857.... BUT 1.4
could please someone (Mack?) write the exact variable?
Thanks


For this message Isma has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: round a variable to 1 decimal
PostPosted: February 6th, 2018, 12:10 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Multiple it by 10, then round, then divide it by 10. All available as Actions under the variable sub-group.

</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: round a variable to 1 decimal
PostPosted: February 6th, 2018, 4:37 pm 
Offline

Joined: August 5th, 2010, 1:42 pm
Posts: 109
Opus: Creator v9 Opus v7
OS: windows
Thanks Mack,
but I can't see the way to add those actions to my text.
I know how add a multiply, round or divide action to a variable, but my average score (nota media) it not a variable
is a text with some operations <(SCORE_CORRECT*10)/SCORE-TOTAL>
Could you send an example if it's not too much ask?
I wanted to include a picture or a pubblication but apparently the board attachment quota has been reached.??


For this message Isma has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: round a variable to 1 decimal
PostPosted: February 6th, 2018, 6:35 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
You mean you're using a Constant Expression in a Text Box?

</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: round a variable to 1 decimal
PostPosted: February 6th, 2018, 7:56 pm 
Offline

Joined: August 5th, 2010, 1:42 pm
Posts: 109
Opus: Creator v9 Opus v7
OS: windows
yes, it's a constant expresion in a text box.
I need to round it to 1 decimal. Can I insert somethng to that expresion to do it?


For this message Isma has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: round a variable to 1 decimal
PostPosted: February 6th, 2018, 9:15 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Code:
Math.round(myVariable * 10) / 10


Where myVariable is your expression that results in 1.42857

</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: round a variable to 1 decimal
PostPosted: February 7th, 2018, 11:27 am 
Offline

Joined: August 5th, 2010, 1:42 pm
Posts: 109
Opus: Creator v9 Opus v7
OS: windows
Thank you, I got it.


For this message Isma has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group