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.
Juggernaut

Featured Replies

Please help if you can. I need to format some numbers with a calculation. I want numbers greater than 100 to show as whole numbers, which I can do with the Int or Round function, but I also need numbers less that 100 to display to the hundredths place. It needs to show two and only two places to the right of the decimal regardless of how precisely the number is entered (i.e. 1.006% should be 1.01%; $7 should be $7.00; and $105.67 should be $105.)

Have you tried the formatting that is available for number fields in Layout Mode?

Layout Mode >> Select Field(s) >> Format >> Number

HTH

Lee

  • Author

Yes, but the formatting needs to change based upon the amounts, as well as whether it represents money, percentages, etc. Here is what I've come up with so far, but I can't get the decimal places portion.

Case ( benchmark_unit = "#" ; Let ( [

len = Max ( 2 ; Length ( Mod ( benchmark_target; 1 ) ) - 1 )

] ;

Round ( benchmark_target;1 )) ) &

Case ( benchmark_unit = "$" ; If(not IsEmpty (benchmark_target ); Let ( [

len = Max ( 2 ; Length ( Mod ( benchmark_target ; 1 ) ) - 1 )

] ;

"$" &

Int ( benchmark_target )

);" ") ) &

Case ( benchmark_unit= "%" ; If(not IsEmpty (benchmark_target);( Let ( [

len = Max ( 2 ; Length ( Mod ( benchmark_target; 1 ) ) - 1 )

] ;

Int ( benchmark_target )

& "." &

Right ( 10^len & benchmark_target * 10^len ; len ) & "%"

) );" ") )

You might want to try something along the lines of:

Let ( [

p = 2 * ( number < 100 ) ;

r = Round ( number ; p )

] ;

Int ( r )

& "." &

Right ( "00" & Round ( r * 100 ; 0 ) ; 2 )

)

This doesn't deal with the placement of the unit, but that should be relatively easy to add. Note also that only non-negative numbers will be processed correctly.

  • Author

Thank you very much for your help. I've edited my calculation accordingly, and it is responding almost the way I intended except for one thing.

For the numbers that I can show to the hundredths place, I don't want to show .00, but the actual value (.67, .70, .99, etc.). I am playing around with the mod function, but so far I haven't come up with the solution.

Edited by Guest

Now I am confused. I thought you wanted precision of 2 decimal places if the number is below 100, and that's what it does. If you want to drop the ".00" for numbers above 100, try:

Let ( [

p = 2 * ( number < 100 ) ;

r = Round ( number ; p )

] ;

Int ( r )

& Case ( r < 100 ;

"." &

Right ( "00" & Round ( r * 100 ; 0 ) ; 2 )

)

)

  • Author

I apologize; I messed up the syntax. It's working now. Is there a way to deal with negative numbers in this scenario?

Something like this, perhaps?

Let ( [

a = Abs ( number ) ;

p = 2 * ( a < 100 ) ;

r = Round ( a ; p )

] ;

Case ( number < 0 ; "-" ) &

Int ( r ) &

Case ( r < 100 ;

"." &

Right ( "00" & Round ( r * 100 ; 0 ) ; 2 )

)

)

  • Author

That'll work. Thank you

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.