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
  • General
  • Create a Logical Field via the Data Dictionary
Back to Manual

How to Create a Logical Field via the Data Dictionary

 

Logical Fields are fields that do not physically exist within your databases' tables, but rather are configured by you as a Developer. m-Power's Data Dictionary structure allows you to define these logical fields just one time, and you are able to access them throughout any application within that Data Dictionary. For example, let's say your Database consists of a MMDD field and a YY field. Rather than having to concatenate these two fields together for every single application you create (via a Calculation), you could just define this field at the Dictionary Level. Once this is done, your new logical field will simply be another field to select when you are picking all of your other fields.

There are four different Logical Fields you can create:

  • Calculation
  • Concatenation
  • Substring
  • User-Defined Functions (UDF)

Calculation

Similar to creating calculations at the application level, this feature allows you to create the same calculation, except it will exist at the Dictionary level. To create, click the "Manage Data" button. Then click the "Manage Tables" button. From here, find the table you with to add your logical field to, and click the "Fields" icon for the appropriate table. Click the "Create
Logical Field" button. Be sure to specify your field name and click "Save and Proceed to Step 2."

Create your calculation as you normally would. Feel free to use any technique you normally would when creating a calculation, such as including database functions and IF/ELSE logic.
Note: Data Dictionary calculations can only reference fields that exist in the same table.

Click "Accept". You have successfully created a new calculation logical field. Now, when you are creating/modifying existing applications, you will see this logical field at the bottom of your list of Fields when you click the Table/Field Selection link.

Concatenation

Concatenation allows you to combine up to 10 fields together into one field. Click the "Manage Data" button. Then click the "Manage Tables" button. From here, find the table you wish to add your logical field to, and click the "Fields" icon for the appropriate table. Next click the "Create Logical Field" button.

Ensure your Field Name is 10 characters or less and contains no spaces. Click "Accept".

Specify a Field Description and an Edit Code if necessary. Next, use the "Look-up" links to select Fields in this table to concatenate together.

Note: You can only concatenate fields upon fields. You are not able to place literal text to delineate between different fields at the Data Dictionary level.

Click "Accept". You have successfully created a new concatenation logical field. Now, when you are creating/modifying existing applications, you will see this logical field at the bottom of your list of Fields when you click the Table/Field Selection link.

Note: You can modify this logical field in the Manage Fields screen, accessible from the Manage Tables –> Fields for the appropriate Table.

Substring

Substring allows you to place a given section of a field into a new field. Click the Admin tab. Then click the "Registerd Tables" link. From here, find the table you wish to add your logical field to, and click the "Fields" link for the appropriate table. Next click the "Create Logical Field" link.

Ensure your Field Name is 10 characters or less and contains no spaces. Click "Accept".

Specify a Field Description and an Edit Code if necessary. Specify your field by clicking on the Look-up link to see a list of available fields. Be sure to specify a Starting position and a length.

Note: The starting position is 1. So in the string CHICAGO, the first "C" would be in position 1, whereas the second "C" would be in position 4.

Click "Accept". You have successfully created a new substring logical field. Now, when you are creating/modifying existing applications, you will see this logical field at the bottom of your list of Fields when you click the Table/Field Selection link.

Note: You can modify this logical field in the Manage Fields screen, accessible from the Manage Tables –> Fields for the appropriate Table.

User Defined Function (UDF)

User Defined Functions (UDFs) allow you to add custom logic directly to a table. For instance, you could define a Profit Calculation at the Data Dictionary Level or Convert a Date. The advantage of using a UDF is that the setup only needs to be done once, rather than at the application level (which would need to be repeated per application). Click the Admin tab. Then click the "Manage Tables" link. From here, find the table you wish to add your logical field to, and click the "Fields" link for the appropriate table. Next, click the "Create Logical Field" link.

Ensure your Field Name is 10 characters or less and contains no spaces. Click "Accept".

Specify a Description for your UDF, then select the pre-defined UDF from the dropdown list.

In this case, I have selected the "Get Character Field from Numeric Date" option. As soon as you select your UDF, additional fields are displayed. I can set the field's Length (currently set to 10), up to the displayed maximum allowable length as defined in the UDF. If the selected UDF returns a true date, Date Format may be selected; if the selected UDF returns alpha/numeric data, Edit Code may be selected.

If the UDF requires input parameters, fields for mapping these parameters are displayed below. In this example, I have selected the "Get True Date Field from Numeric Date" option. I need to map the "Input numeric date" to a field in this table. The dropdown will display eligible fields based on data-type and length. If there are no eligible fields, or if you would rather map to a constant field, select the "Map a Constant" option from the "Map Field" dropdown. A valid constant may be a literal, enclosed by single quotes, or an expression. Expressions may include mathematical calculations, fieldnames, and SQL functions. For example, you may wish to pass legacy or decomposed date fields as one parameter; to do so, your constant expression would look like this: (FLD_CENTURY * 1000000) + (FLD_YR * 10000) + (FLD_MTH * 100) + (FLD_DAY). Please note that literal expressions must be enclosed in single quotes. For the example below, I have selected my field "DATORD". "DATORD" happens to be in 'YYYYMMDD' format, and as such, that is what is listed for the Input Format "Constant" value. Note how it is enclosed in single quotations.

Click "Accept". You have successfully created a new User Defined Function (UDF) logical field. Now, when you are creating/modifying existing applications, you will see this logical field at the bottom of your list of Fields when you click the Table/Field Selection link.

Created: October 7, 2011 | Modified: November 30, 2015

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

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

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.