Jump to content

Recommended Posts

Posted (edited)

I have a database of airports and have a layout where I show airport info. Here is a screenshot of the Canadian airport data:

The 4th column shows enplanements, or the number of passengers boarding flights (the field name is "enp2023"). I use this formula to display the numbers as X.XM (millions to one decimal place). This is the formula for the field:

Round(enp2023/1.0e+6;1)&"M"

However when it is an even million the number is truncated and doesn't show 4.0M (as for Edmonton) but simply 4M. I'd like it to display as shown in the rightmost column (these have been entered manually), as 4.0M. How do I do that?

Thanks in advance.

Screenshot 2025-05-20 at 10.50.44 PM.png

Edited by rcacciato
typo
Posted (edited)
6 hours ago, rcacciato said:

when it is an even million the number is truncated and doesn't show 4.0M (as for Edmonton) but simply 4M.

You need to separate between rounding and formatting.

Rounding is a numerical operation that results in a number - and numbers do not have trailing zeros or characters that indicate units. Your calculation attempts to do both rounding and formatting but it fails to add a trailing zero where required.
 

I would suggest you let your calculation do only the rounding part:

 Round ( enp2023 / 10^6 ; 1 ) 

and set the result type to Number.

Then format the field instance on the layout to display as Decimal with a fixed number of decimals and a trailing symbol:

image.png.1d0d48d524d37a2cb6937a03470d8305.png


(Note that for display only the calculation could be just:

enp2023 / 10^6

and the formatting would do the rest.)

 

Edited by comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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