1. Home
  2. Knowledge Base
  3. Customize Your Applications
  4. Freemarker
  5. Freemarker Edit Codes to Control Data Rounding

Freemarker Edit Codes to Control Data Rounding

This documentation describes how to use Freemarker edit codes to hide decimals from view, while still allowing it to be used in calculating sub and grand total levels.

Example Scenario

So that you can easily see the difference, a Regular Report application has been built with the dimension key set to the Customer State. Only one numeric field has been selected (Original Field). For comparison purposes, a calculation has been used to replicate this numeric field (Edited Field).

Before any editing is done, my report output looks like this:

Since this requires HTML editing, we must open m-Painter.

Right-click on your field at the detail level, and select “Cell” then “Edit Cell HTML”. Replace ?html} with _o?string("$,##0")}.

Be sure to repeat the process for your field on the sub-total and grand-total rows.

Click the “Save” button & run your application. My output now looks like this:

The Original Field was left unaltered to show the comparison between itself and the HTML edited field.

Other Formatting Options

You can utilize numerous formatting, such as the following. (Assuming the field value is 1.234)


You can even use this same method for Rounding purposes:

· If value = 1.2, then ${FIELD.string("0")} yields 1.

· If value = 1.8, then ${FIELD.string("0")} yields 2.

· If value = 1.5, then ${FIELD.string("0")} yields 2 (Rounding always goes to nearest even number).

· If value = 2.5, then ${FIELD.string("0")} yields 2 (Rounding always goes to nearest even number).

Updated on September 14, 2023

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Contact Support