Skip to Content mrc logo mrc logo
  • 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
  • What does m-Power build?
    Solutions by Industry
    Overview Database Front-Ends AI 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 & Web Services Db2 Web Query Alternative
    Solutions by Industry
    Overview Manufacturing Government Foodservice Software Vendors Logistics & Supply Chain Software Consultants Healthcare
  • Development Services Training Mentoring
  • Overview Partners Press Releases Careers Events Contact Blog
  • Support Home FAQ Documentation Customer Portal Enhancements Updates Roadmap Techblog
Try m-Power

m-Power Manual

Browse:

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

String Functions Available within Freemarker

 

There are many String Manipulation tools available to you within Freemarker. Often times, adding these Freemarker options will save you time, give you greater flexibility as a developer, and make your applications even more robust. 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 String Function into the "Representation" box in the correct location. When completed, hit OK. Then be sure to save your application.

Here is a list of many common and useful String Functions available to you within Freemarker Logic.

Sub-stringing

While you can sub-string as a calculation, you can also sub-string using Freemarker. An example of its usefulness would be sub-stringing a portion of a common field.

Note: Please remember that the 1st character of your string is the 0 position. If my ${row.CITY} equals "CHICAGO", the following expressions would give these results:

Freemarker Code Result
${row.CITY?substring(1)} HICAGO
${row.CITY?substring(3)} CAGO
${row.CITY?substring(0,1)} C
${row.CITY?substring(0,3)} CHI
${row.CITY?substring(2,3)} I

Capitalize First Letter

The function ${row.FIELD?cap_first} will capitalize the first letter of your field if it is lower case. All other letters are ignored.

Un-Capitalize First Letter

This function is the exact opposite of the one listed above, and the function and is written ${row.FIELD?uncap_first}.

Capitalize

This function will capitalize the first letter in all words and un-capitalize all other letters. This function is denoted ${row.FIELD?capitalize}

For instance, a normal output of "LOS ANGELES" would output "Los Angeles" with the ?capitalize freemarker function.

Upper Case

This function will capitalize all letters within a string. It is noted as ${row.FIELD?upper_case}.

Note: If you are in a Maintenance application and trying to ensure upper case from the user, please use the "Do not Allow Lower Case" option from the Pre-format Level.

Lower Case

This function will un-capitalize all letters within a string. It is noted as ${row.FIELD?lower_case}.

HTML

This function will encode all fields for use within an HTML page. For instance, if your field contains an "&" it will be encoded to the HTML version of the ampersand "&". This guarantees that the browser will handle all fields correctly. This is the default encoding for all generated fields with m-Power. It is noted as ${row.FIELD?html}.

URL

This function will encode all fields for use within an HTML's URL. For instance, if your field contains an "#" it will be encoded to the URL version of the pound sign "%23;". This guarantees that the browser will handle all fields correctly when being passed along the URL. This is the default encoding for all fields that a user selects through the Hyperlink Wizard within m-Painter. It is noted as ${row.FIELD?url}.

Trim

The Freemarker Trim function will remove all leading and trailing spaces from a field. It is denoted: ${row.FIELD?trim}

Length

The Freemarker Length function will return the number of characters in the field. It is denoted: ${row.FIELD?length}

Replace

This is a very useful Freemarker function as it allows you to replace a certain value directly within your field. It is denoted:

${row.FIELD?replace("FINDTHISTEXT", "REPLACEWITHTHISTEXT")}

For example, if my Field value was CHICAGO, and my function looked like this:

${row.FIELD?replace("CAGO", "NA TOWN")}

My output would be "CHINA TOWN". This is just an abbreviated list showing the most common Freemarker String Functions. A full list can be found here.

Created: September 11, 2008 | Modified: April 8, 2020

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

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

See all tags »

mrc

Build the custom apps and AI tools your business needs with m-Power, or have our Chicago-based team build them with you. One platform, one team that makes sure you succeed.

Since 1981 · 1,500+ customers · 4.7/5 on G2

m-Power
Overview Demos Build Process Licensing Specs Get a Demo
Solutions
Database Front-Ends Reporting AI Tools Dashboards ERP Enhancements Modernization See all solutions
Company
Case Studies Services About Blog Careers Contact Support

Privacy Policy Cookie Policy Cookie Settings

michaels, ross & cole, ltd. (mrc)
US: 2001 Midwest Road, Suite 310, Oak Brook, IL 60523 · 630-916-0662
UK: Mortlake Business Centre, 20 Mortlake High Street, London, SW14 8JN · +44-20-335-59566
© mrc. All rights reserved.