Page 1 of 1

Round

Posted: Fri May 03, 2013 12:52 am
by Nakia
Hi,

Is there a way when using the Round() function to force it to inlcude the "0's" in its result?
For example.

I have a value that is "212" and I want to to the Round() function to 3 decimal places 3 so I want the value returned at "212.000"
Now, before you ask Yes i konw these are the same value but the reason I want to do this is so the fld I am placing this data in keeps its alignment between each item (Tab Del) consistent.
Note, this is for a reporting application.

Re: Round

Posted: Fri May 03, 2013 1:05 am
by Simon
Isn't this done by:
set the numberFormat to "#.000"

Simon

Re: Round

Posted: Fri May 03, 2013 1:55 am
by sturgis
Yeah numberformat is a good way to go, or alternatively look at the format() function.

Re: Round

Posted: Fri May 03, 2013 4:12 am
by dunbarx
What those guys said.

This goes back to the earliest days of Hypercard. Read up on the "numberFormat" property, especially the use of zeros and hashmarks to format in the desired way. This takes a little practice. Also, pay attention to the fact that a numeric calculation must oftentimes be performed on a value to force it to display as it was ordered to. This may take the form of:

add 0 to yourRecentlyFormattedString

or the monumental:

multiply yourRecentlyFormattedString by 1

This also takes practice.

Craig Newman

Re: Round

Posted: Fri May 03, 2013 12:01 pm
by dave_probertGA6e24
This would also do it:

Code: Select all

put format("%d.000", round( fff )) into ooo
Cheers,
Dave

Re: Round

Posted: Wed May 08, 2013 12:22 am
by Nakia
dave_probertGA6e24 wrote:This would also do it:

Code: Select all

put format("%d.000", round( fff )) into ooo
Cheers,
Dave
This worked perfect, thanks dave!!!