Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How can I add trailing zeros? 1.00 need 1.000

Featured Replies

I have several separate number fields that were entered with values like this:

4.23

13.7

.52

STEP 1: I need them to be padded with trailing zeros like this:

4.2300

13.7000

.5200

STEP 2: and then I need them to be joined as a text string like this:

4.2300|13.7000|.5200

I can handle writing the calculation for step 2, but I am trying to determine the simplest code to use for step 1.

Any suggestions?

Thanks.

N::Number & If( (Length( N::Number-Int ( N::Number))<5 ) and (Length( N::Number-Int ( N::Number))>1 ) ;Right ( "0000"; 4-Length( N::Number-Int ( N::Number) ) );"") & If( (Length( N::Number-Int ( N::Number))=1 ) ;".0000";"")

should work, or implement as custom function if desired. N::Number is the number to round. The number less its INTeger component is the decimal part of the number; the length of the decimal part determines how many digits are present. Hence 4-the digits present equals the number of zeros to postfix to the value (length function counts decimal point). The special case of no digits (whole number) requires also that a decimal point be postfixed to the value. The second IF could alternately be handled with a CASE function.

Try:


Let ( 

r = Round ( number ; 4 ) 

;

Int ( r ) & SerialIncrement ( ".0000" ; Mod ( r ; 1 ) * 10000 )

)

Note that this assumes non-negative numbers.

  • Author

thanks very much for the replies

  • 4 years later...

Try:

 

Let ( 
r = Round ( number ; 4 ) 
;
Int ( r ) & SerialIncrement ( ".0000" ; Mod ( r ; 1 ) * 10000 )
)

Note that this assumes non-negative numbers.

 

 

An old thread I know but… is there a simple way to get this to work for negative numbers?

thanks

Try =

Let ( [
r = Round ( number ; 4 ) ;
a = Abs ( r )
] ;
Case ( r < 0 ; "-" ) & Int ( a ) & SerialIncrement ( ".0000" ; Mod ( a ; 1 ) * 10000 )
)

excellent - thanks

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.