Numeric Formatting with Freemarker

Click here to access legacy documentation for this feature

m-Power and Edit Codes

Are you new to the IBM and not very familiar with Edit Codes? Or have you not dealt with Edit Codes in some time? Not sure the difference between “J”, “X”, and “A”? Not to worry — not all of our customers are proficient with edit codes and now with m-Power applications, you don’t need to be! The new flexibility of m-Power applications will allow you to add edit codes directly to the source of your application.

Note: Of course, the standard edit codes that many of you are comfortable and familiar with will still work in the same fashion. However, this new method of adding edit codes allows for much more flexibility within your applications.

In addition, Edit Codes are primarily known for Numeric Fields. The following manipulations modify your numeric fields into strings for additional manipulation capabilities.

Currency

Be sure to compile your application. After the program is compiled, enter m-Painter.

Left-click in the cell of the data field you wish to add formatting on (In our case it is the field named “Currency”). From the right-side Element Panel, select “Edit HTML”.

Within this text area, append the text _o?string.currency directly after the field name. This _o?string.currency tells your field that you wish to utilize a currency mask on the field.

Note: The entire field now reads ${row.CURRENCY_o?string.currency}

The output is as follows (notice the “$” and the “.” Denoting cents):

European Currency

In some European countries, $1,120.50 would be listed as 1 120 ,50. To do this in m-Power, open m-Painter. Left-click in the cell of the data field you wish to reformat. On the right-hand Element Panel, select “Edit HTML”. The specific cell you selected will be displayed. Click the button to “Move to parent” to display the entire table row.

Find the <td> for the desired field to reformat and directly above the <td> add: <!--<#setting locale="hu">--> and to your field add FIELD_o?string.currency. See below:

Your output will look like this:

Percent

Similarly, we can follow the same steps as above, this time adding _o?string.percent directly after the name of the field.

The resulting output is:

Updated on January 4, 2024

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