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?
    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 & 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
  • General
  • Field Conversions
Back to Manual

Field Conversion

 

Introduction

The Field Conversion feature is a powerful solution for cases when a database field is stored in one format, but that value needs to be converted to another format for display purposes.

Any database field might be stored in a format different from its intended display format. In that case, the application is expected to handle that conversion and editing. This feature makes it possible for a developer to write that conversion and editing logic and assign it globally to a particular field in m-Power. Then, m-Power users who make applications over that database will be able to use those fields without adding additional logic to the application and be assured that those conversions and editing will be invoked automatically for them. This greatly simplifies the process of creating applications over fields stored in a format other than their intended display format.

Example Uses

Applicable examples include:

  • A numeric value that represents a date
  • A numeric value stored without decimal positions representing a value that does contain decimal positions
  • A character string storing right-justified values representing a numeric value

Where This Feature is Seen

This feature enables the m-Power administrator to define a Java class that contains custom methods for:

  • Converting a database format to a display format
  • Converting a display (or user-entered) format to a database format
  • Editing a user-entered value

The custom logic for those methods can be written to enable any format swapping and editing needed for any special field conversions. The m-Power client is responsible for creating their own custom logic for their own purposes.

mrc-Supplied Conversion Classes

mrc ships the following classes with m-Power, as examples of implementation:

  • Class com.abc_co.mrcextension.JDEDateConvert converts a JD Edwards date field stored in CYYNNN format to MMDDYY format.
  • Class com.abc_co.mrcextension.FieldConvert150to72 converts a field stored as 15,0 to 7,2.
  • Class com.abc_co.mrcextension.FieldConvert150to82 converts a field stored as 15,0 to 8,2.
  • Class com.abc_co.mrcextension.FieldConvert150to113 converts a field stored as 15,0 to 11,3.

Writing a Custom Conversion Class

The code for Conversion Class JDEDateConvert is supplied here. Follow that example when creating custom Java classes.

How to Define a Conversion Class to a Field

To define a field to convert go to "Manage Data" –> "Manage Tables" and go into "Fields" on the table with the field(s) you want to convert.

Next, edit the field you want converted. The last line of the "Update Dictionary Field" is where you enter the name of the conversion class, listed above.

When you hit "Accept", the field will be converted over in all newly-compiled applications. Now, when m-Power receives the data from the database it will convert it to display in the new format on all applications.

Special Notes

Notes for Fields Defined with a Conversion Class:

  • Formatting of numeric values is still handled with Format Codes.
  • Record selections should be entered with the display format, not the database format.
  • Calculations are treated differently depending on their type. Database Calculations are handled directly in the SQL statement, while Application Calculations are processed after the SQL statement has been executed. Because of this difference, fields assigned with a Conversion Class and used within the calculation expression or the calculation conditions will be handled differently. Database Calculations will use the database format and Application Calculations will use the display format.
  • When a field is defined with a Conversion Class, that logic is applied to all applications using that field in that Data Dictionary. The conversion cannot be un-applied at an application level.

Created: January 31, 2011 | Modified: December 3, 2013

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

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

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


© mrc. All rights reserved.