Percent formatting (1 Viewer)

techexpressinc1

New member
Local time
Yesterday, 18:22
Joined
Jun 28, 2017
Messages
2
We want the screen to show a percent with up to 4 decimal places, a value can be i.e.: 5.1234%
But if the value does not have 4 decimals not to show the ending zeros.
If the value is 5.12% - only show 5.12% not 5.1200%
If the value is 5.1234% - show 5.1234% not 5.12%
__
Table field parameters:
Type Numeric, Field Size = Single, Format=Percent, Decimal Places=4
_
Form Format parameters:
Format Percent, Decimal Places = 4, shows all 4 but when 5.12 shows 5.1200
Format Percent, Decimal Places = Auto, when 5.1234 show only 5.12

Is there a way for this to work?
Thx
Russ
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 18:22
Joined
Aug 30, 2003
Messages
36,140
As answered elsewhere:

Try the Format() function:

?format(.0512,".0000%")
5.1200%
 

Tieval

Still Clueless
Local time
Today, 02:22
Joined
Jun 26, 2015
Messages
475
I think what is being asked for is the opposite of this, just show relevant decimals so 5.1200 becomes 5.12% and 5.1234 becomes 5.1234%, I am guessing you could trim zeros but it is a lot of effort.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 02:22
Joined
Feb 19, 2013
Messages
16,739
you haven't really provided a full range of possibilities

a format string of 0.####%

will change
0.0512 to 5.12%
0.051234 to 5.1234%
but
0.05 will be 5.%

a format string of 0.0###%

will change
0.0512 to 5.12%
0.051234 to 5.1234%
but
0.05 will be 5.0%
 

Users who are viewing this thread

Top Bottom