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

Rounding a calculation field

Featured Replies

I have a calculation field that needs to be rounded to two decimal places. I have tried rounding the calculation field itself as well as formatting it in a Send Mail script step, doesn't work anywhere. Calculation result is Number.

Calculation field

[color:blue]Round ( Sum ( Accessions::calTotalCharges ) ; 2 )

Send Mail script step

[color:blue]Round ( Projects::calTotalCharges ; 2 )

Replacing the field reference with a number, it rounds fine. Can I not use ROUND with a field reference?

When you say "doesn't work" ... ?

  • Author

The calculation is correct, just not the way it is displayed. The calculation field in the Send Mail script does not round to two decimals.

126 instead of 126.00

432.5 instead of 432.50

I can use a field and format it, but cannot use in a email script.

Rounding is a numerical operation, and the results you show are correct: a number does not have trailing decimal zeros. What you want is not (only) rounding, but formatting, e.g. =


Let (

r = Round ( Sum ( Accessions::calTotalCharges ) ; 2 )

;

Int ( r )

& 

SerialIncrement ( ".00" ; 100 * Mod ( r ; 1 ) )

)

The result type needs to be Text. Note that the above assumes non-negative numbers.

Try...

Let([

number = 123;

rounded = Round(number;2);

integer = Int(rounded);

decimal = rounded - integer;

point = Case(decimal = 0; ".");

decimalDisplay = Left(point & decimal & "00";3);

result = integer & decimalDisplay

];

result

)

Edited by Guest
comment's is, as par, more elegant.

  • Author

Comment,

That did it, thanks for your quick (and helpful) response!

Dan

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.