Calculations
The Calculations specification is an important tool in designing applications, allowing you to create new fields to work with in subsequent calculations, record selections, and external objects. Through calculations, you can create numeric and character expressions, call database functions, and perform conditional logic.
Input Fields:
Field Name- When creating new fields in summaries, you need to specify a field name. This name will be the name of the field in the database.
Calc Type- Select your calculation type from the dropdown: database, system value, parameter, application, or external object. Database calculations are the most common calculation type, and will meet the needs of most new m-Power developers. For more information on calculation types, click here.
Description- Enter a description of the field that will appear in your application.
Data Type- Select either numeric, alpha, or date.
Length- Specify the length of your field. Remember that the calculation may change the expected field length, and in some instances it is a good idea to have a small buffer. Note: the length includes the length of the decimal, and extra digits will automatically be trimmed. For instance, 45.342 will have a length of 5, and a decimal of three.
Format- Select the desired format. m-Power comes equipped with commonly used numeric and date formats. However, you can also design your own formats.
Round- If set to yes, the decimal portion of the value will round up if the decimal is greater than or equal to .5 , otherwise the value will round down. If rounding is set to no, the decimal will truncate depending on the specified length.
Calculation- Input your calculation in the largest input box. You may type in your calculation or use the calculator provided. The fields and functions available to use will depend on the calculation type.
Conditions
m-Power is equipped to add conditions to calculations. Data that matches the requirements of the condition will process the calculation. To add a condition, click Add New. This opens the Conditions box.
Select the desired field and relationship from the respective drop down lists, and enter a value. Finally, select either "And" or "Or" from the final drop down. Selecting "And" will require the subsequent condition to also meet the required relationship for the calculation. Selecting "Or" will allow the calculation to process if either of the conditions are met.
For more information on calculations, please click here.