m-Power Documentation

New m-Power Calculation Screen

mrc is excited to announce a significant improvement to the Calculation creation process. m-Power's Calculation screen has been improved to include the following improvements:

· Calculations as Sequence keys and Record Selection fields – Calculations have been completely redesigned to take full advantage of SQL. Now almost every calculation is available to use as a sequence field or record selection field.

· Sequence/Record Selection Availability – The Work-with Calculation screen now shows which calculations are available for Sequence/Record Selection within your application.

· Improved On-screen fields and Calculator – You can now see up to 15 fields at a time, and a calculator is now displayed on screen to easily enter numbers and operators.

· Cursor Sensitivity – Place your mouse where you would like your field to go or highlight text and select a field. Rather than placing the text at the end of your expression, your value will automatically be inserted at the location of your cursor.

· Improved Data Type selection – Selecting your data type will automatically filter out attribute options so that you can only choose from valid options.

· Easier to add SQL functions – After selecting that you wish to include an SQL function, a list of available options and the proper syntax is shown for you.

· Redesign of Edit Codes – Edit Codes have been redesigned to now show you the appropriate output based on the attributes of your calculation, rather than having to remember every IBM Edit Code.

· Improved Error Messages – In the rare occurrence of bad syntax, the calculation screen will provide a much more specific error message to help you resolve the issue.

· SQL Edit Checks – m-Power will now evaluate your SQL syntax. If there are any errors they will be caught before compile, rather than at runtime.

· System Values improvement – You can now add system values (System Date, Time, User, etc...) with greater ease.

· External Objects – External objects are now much easier to add. Simply select that you wish to call an object, define attributes and click Add. It's that easy.

· Application Parameters – Passing data between applications via Application Parameter is now much clearer.

Note: Hover over your fields to see the field name and field attributes.

The Basics

Calc Type
There are Five valid options are:

1. Database

2. System Value

3. Parameter

4. Application

5. External Object
(Note: Once a calculation has been added, you are not able to change this option for the given calculation).

1. Database
This is the default option for all new calculations. This option allows you to add almost any kind of calculation. Numeric, and SQL functions are called through this option. Under the expression text area is a list of fields already defined to this application. For more information, simply hover your cursor over the field descriptions to show the field name and field attributes. Here are common example of how expressions are utilized:

Utilizing the Add, Subtract, Multiply, or divide operations with numeric fields

Numeric calculations involve any kind of arithmetic logic. Most common values would be similar to this:
&FIELD1 + &FIELD2     Two fields
&FIELD1 / 72 Fields, in conjunction with Static Numbers
Of course, you can use + (Addition), - (Subtraction), * (Multiplication), and % (Division).
Note: You can utilize the on-screen calculator to enter non-field information (such as numbers or numerical operators) or use your keyboard.
Note: If you inadvertently press the “Clear” button on the onscreen coordinator, typing CTRL + Z will restore what you typed, barring you did not make any additional changes.

Creating literal fields

Alpha calculations are very useful for displaying literal text.
To enter literal text, be sure to wrap any literal text within “ ”.
For instance, if I wanted the word Hello as my calculation for each record, I would add the following as my Calculation Expression: “Hello”
Note: Alpha calculations are unable to serve as record selections/Sequence (key) fields .

For use within If/Else logic

If / Else logic is vital for times when your output depends upon something else. You can test any field against another field, a literal value, or blank/null.
For operand LS - in the list, you should enter each list value separated by a blank. If you cannot fit all your list values on one line you must enter an additional list statement separated by an OR.
For operand RG - range, you must enter two values separated by a blank.
Note: To test for blanks in a field use the value *BLANK.
Note: Calculations that contain If/Else logic are unable to serve as record selections/Sequence (key) fields .

To call SQL Expression
This option allows you to call SQL expressions for your specific database. Click the Functions tab and your listed fields will be replaced with a list of pre-defined SQL functions. Hover over any of the listed SQL functions to see what the function does and the appropriate syntax. Clicking on the function will place the default syntax in the calculation for you. From here, click the “Fields” tab to be shown a list of given fields. Lastly, add the fields to the SQL syntax to complete your SQL Expression.

For instance, if I wanted to concatenate field ABC & field XYZ, I would click the “CONCAT” function. This will place the correct syntax into my calculation. Next, I click the fields tab to see a list of the fields I can use. Double click “field1” and click field “ABC.” This will replace “field1” with “&ABC”. Repeat the process for the second concatenated field.

Note: The examples provided are examples of the functions in their simplest form. You can add additional syntax as needed. (For instance, in the example listed above, I could concatenate a third field if necessary, even though it is not listed within the default syntax.)

Note: mrc recommends utilizing SQL functions over Java functions whenever possible as SQL functions allow you the added benefit of the calculation allowing sequencing and/or record selection due to the fact that SQL functions are performed directly within the SQL statement.

Note: This list of available expressions can be modified to add/remove SQL functions. This file is located in \m-power\proddata\conf\mrcSqlFns.xml

The above screen shot shows the Calc Type has been changed to “SQL Expression.” Notice also that the Data Type has been set to Alpha, eliminating the “Decimal option.” Also, notice the list of SQL Functions listed where the Fields normally are located. Click the “Fields” tab to go back to the Fields listing.
Note: You can easily replace the default syntax of the SQL expression, by highlighting the field you wish to replace, then click the field you want to replace it with. m-Power will automatically replace the highlighted text with the field you selected.

2. System Value
System Values allow you to enter “common” information into your application. For example, this option allows you to enter the Current Date, Time, User, Session ID, Data Dictionary, and/or Program Name. Specify a field Description, then click the System value you wish to include. The field attributes, and default calculation expression will be entered for you. Click “Accept” to create your calculation.

In the above screenshot, you can see that I have selected “System Value” as my Cal Type & have also specified a Calculation Description. As soon as I clicked the “Current Time” button, the Data Type, Length, and Decimal were set for me automatically.
Note: It is no longer necessary to add *TIME, *DATE, etc to the application description.

3. App Parameter
Some customers may be familiar with this feature under a different name, Constant Calculation. Application Parameters serve as a way for you to pass data from one application to another. This method is especially useful if you are trying to pass a data field from one application to another application where no field exists to accept that parameter. An App Parameter can be created to match the attributes of that field. To do this select “App Parameter” and specify the length you wish your App Parameter to be. Lastly, specify a Description and click “Accept.” After your Application Parameter is created, go back to your original application and pass the necessary field to the appropriate calculation name of your Application Parameter. More information about Application Parameters can be found here .

In the screenshot listed above, you can see that I have specified “App Parameter” as my Calc Type. I can customize the application by Description, Data Type, Lenth, & Decimal. The calculation expression is determined for me.

4. Application
This option allows you to call Java Functions. However, mrc recommends that you always use Database calculations as this option allows the ability for the calculation to be a sequence field and/or a record selection field.

5. External Object
This option allows you to call external Java/RPG/CL programs from within your calculation. When called from a calculation, your external object will be called for each row that is printed. Usually, customer's should choose this option (rather than calling an external object from the Application Options screen) when their object needs to return a value. When that happens, creating a calculation allows you to place that returned value into the calculation itself. Select “External Object” as the Calc Type, specify the necessary Data Type, Field Length, & Field Decimal. Click the “Choose external object…” button to advance to a secondary screen that will allow you to select the object, the object location, and any object parameters.

In the above screenshot, I have specified External Object as my Calc Type, I have specified a Description and set a Data Type. From here, I simply will click “Choose an external object…” The next screen will allow me to pick the actual object needed.

Data Type
This option allows you to control whether your field will be: Alpha, Numeric, Date, Time, or Timestamp. When selecting a data type, the Length & Decimal attributes will automatically be filtered for you to only show you valid options.
For instance, when choosing a numeric calculation, the “blank” option of Decimal length will be removed as numeric calculations must have a decimal length. Or, when choosing alpha calculation, the decimal dropdown will become disabled as alpha calculations do not have a decimal.

Note: Be sure to specify the data type before creating your calculation expression.

Format
The Format option allows you to control how your numeric (or DATE) output will appear. Utilize the “call out” icon to see how your data will appear with the given field attributes and format selected.

N ote: The format option is only valid for numeric calculations & DATE calculations. Additionally, the “call out” icon is only available for numeric calculations.

Note: The calculation screen is designed to work with Web 2.0 templates. However, existing Web 1.0 (Classic Templates) applications will continue to work under the following restrictions:

· Non-modified applications will continue to work.

· You may recompile an application, so long as you make no changes to calculations.

· You can make changes to calculations, but only “Application” calculations and “External Object” calculations can be modified/created.

· Please consider utilizing Web 2.0 technology as it offers quicker, more robust web applications.

Note: Some calculations are not allowed to serve as Record Selections or Key (Sequence Fields). Those that cannot are listed below for your reference:

· Application Calculations

· External Object Calculations

· Any calculations that refer to an External Object or Application calculation

Note: This screen requires the use of Internet Explorer to obtain its full functionality.


subscribe to newsletter
Want to receive weekly insight, tips, viewpoints, and news from a 28-year industry veteran? Enter your email below to subscribe!

m-Power Customers

Customers


mrc (US)
555 Waters Edge
Suite 120
Lombard, IL 60148
630-916-0662
mrc (UK)
Argyle House
1 Dee Road
Richmond, Surrey
TW9 2JN
+44-20-8322-7720