Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

How do I total a column of currency that's in .000 format and then have it round up or down in the total field?

Avatar

Level 4

I have a table that figures mileage at .576 per mile and in the total field I want the total to display as the nearest whole cents result, such as $56.23 or $56.22 depending on the result. I can Sum the column with success but it's the rounding up or down that I don't know how to write into that field. I'd appreciate any help you can offer. Thank you.

1 Reply

Avatar

Level 7

If your total is a Decimal Field set to two decimal places, that should take care of it for you.

765990_pastedImage_0.png

Here's my solution. (The field nfTotal has the settings pictured above.)

765991_pastedImage_1.png

Side note: If you just wanted to test to verify that you'll get the right answer when rounding using a decimal field, create two decimal fields--one with two trailing digits and the other with three. Set the calculate script of one with two decimals to copy the rawValue of the one with three decimals.