mrc logo mrc logo
  • m-Power m-Power
    What is m-Power?
    Overview Demos Build Process Case Studies Specs Pricing Trial
    m-Power Resources
    Overview How-To Videos Webinars & Podcasts White Papers Fact Sheets
  • Solutions Solutions
    What does m-Power build?
    Overview Database Front-Ends Reporting CRM Systems Business Intelligence Dashboards Inventory Management Mobile Apps ERP Enhancements Modernization Spreadsheets to the web MS Access to the web B2B/Web Portals Scheduling Embedded Analytics Web Forms Workflow Data Exploration Budgeting & Forecasting APIs and Web Services Db2 Web Query Alternative
    Solutions by Industry
    Overview Manufacturing Government Foodservice Software Vendors Logistics & Supply Chain Software Consultants Healthcare
  • Services Services
    Development Services Training Mentoring
  • About About
    Overview Partners Press Releases Careers Events Contact Blog
  • Support Support
    Support Home FAQ Documentation Customer Portal Enhancements Updates Roadmap Techblog
Try m-Power

m-Power Manual

Browse:

  • Home
  • Freemarker
  • Numeric Functions within Freemarker
Back to Manual

Numeric Functions Available within Freemarker

 

There are times when you may wish to control the output format of a numeric field within your Java Servlet Applications. Freemarker allows you to do this easily directly within the m-Painter environment. To add these functions, simply open m-Painter and right click on the Field you wish to modify. Select the "Application Field Properties" option. Add the Numeric Function into the "Representation" box in the correct location. When completed, hit OK. Then be sure to save your application.

One of the most useful options available to Numeric Fields within Freemarker is the ability to apply formatting directly within the source of the HTML.

Modifying into a String

The use of the "?string" option is vital. Numeric values such as 1000000 are easy for a computer to understand, but difficult for a human because the zeros run together. However, written like 1,000,000 is very easy for a human to read. Similarly, if a value is smaller than 1E-16 (a number with more than 16 positions to the right of the decimal place) it would be rounded to zero, whereas a string function would display the true value. Converting this value to a string allows the JVM installed to control the look of the value based upon the location. European JVMs could render a value formatting slightly different than a US JVM due to the location.

As an example, let's say that I have a field with a value equal to 1234. If no Edit Code is selected within m-Power, my output will look like this:

Next, I will illustrate the two most popular Freemarker Formatting options: Number & Currency:

My normal field substitution looks like this:

${row.OTHERSS?html} — This outputs the text 1234 (This is the default code generated by m-Power).

${row.OTHERSS_o?string.number} — This outputs the text 1,234.

${row.OTHERSS_o?string.currency} — This outputs the text $1,234.00.

_o — This specifies to Freemarker that this is a numeric field, capable of allowing string manipulation.

string.number — This specifies to treat this field like a normal, numeric field (Using commas and periods where necessary).

string.currency — This specifies to treat this field to display like money (The use of $, commas and period where necessary).

Note: If you are located outside of the US, your string.number and string.currency will display differently as your JVM is written specifically for your country's standards.

Note: Freemarker Formatting codes will take precedence over m-Power Edit Codes.

To learn even more Advanced Formatting for Numeric Fields, click here.

Created: September 17, 2008 | Modified: December 22, 2011

Search


Browse By Category

Build Process (13)
Starting with m-Power (8)
Retrievals (10)
Reports (15)
Summaries (4)
Maintainers (17)
Graphs (8)
m-Power Data Explorer (4)
General (24)
Calculations (5)
Utilities (9)
m-Power Administration (23)
Security (11)
Freemarker (6)
m-Painter (29)
Form Validation (5)
External Objects & UDFs (12)
Deprecated Documentation (23)
Bootstrap Templates (7)

Popular Tags

Maintainers External Objects Graphing Administration Prompt Screens Dates Java Reports Email Security Admin Form Validation Tomcat Summaries mrc-Productivity Series Maintainer Calculations Graphs Popular Build Process Report Bar Graphs Parameters Excel m-Painter Application Properties Advanced RPG Getting Started Freemarker Database Retrievals DB2 Compiling Retrieval Graph Properties Data Dictionary App Properties Dropdowns Production SQL Video Bootstrap Templates Record Selections Performance

See all tags »

michaels, ross & cole, ltd. (mrc)

Privacy Policy Cookie Policy Cookie Settings Notice at Collection Do Not Sell or Share My Personal Information

mrc (US)

2001 Midwest Road
Suite 310
Oak Brook, IL 60523
630-916-0662

mrc (UK)

Mortlake Business Centre
20 Mortlake High Street
London, SW14 8JN
+44-20-335-59566


© 2024 mrc. All rights reserved.