Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 5283 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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?

Posted

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.

Posted

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.

Posted (edited)

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.

This topic is 5283 days old. Please don't post here. Open a new topic instead.

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.