m-Power Data Models

Overview

Data Models are reusable datasets that can be utilized in a variety of m-Power features. They may be utilized in one of two places:

  • m-Power applications
  • m-Power Dashboards (for chart creation)
  • The m-Power Data Explorer

Data Models are most useful when needing to repeatedly query an existing dataset from your licensed database. A single Data Model, when created over a specific data (such as customer information), allows the developer to repeatedly query that single data model; whether that be for creating new applications or for adding runtime functionality (via lookups, dropdowns, and AJAX feature) to existing applications.

This document will focus on creating Data Models for utilization in m-Power applications, as opposed for Data Explorer. For more on building Data Models for use with Data Explorer, please see here.

Why should I use a Data Model?

As a developer, think of any table(s) in your database you find yourself frequently referencing in your applications. Or alternatively, you may have a dataset you want to build chart(s) over. These often will be good candidates for a data model.

Take the following three examples:

Example 1

You have a customer master table which contains every customer’s numbers (ids), customer names, addresses, city, state, etc. This table is frequently looked up in various ways, for example:

  • You have various Web 2.0 Option List retrievals (dropdowns) that point to this customer information.
  • You have different lookup features – such as AJAX Return Data, a JSON Lookup retrieval, or imports (access via m-Painter) that lookup the customer information.

A single data model can be built over this customer information and used to lookup the customer information for these features.

Example 2

You have many reports that query and join the same two tables: an order header table and an order details table. In addition:

  • These reports frequently need the same runtime value prompt filters
  • These reports share identical calculations across each app.

A single data model can be built over those two tables, performing the appropriate joins, filters, calculations, dimensions, etc. needed. All the information from the data model can then be “plugged in” to the new application being made, thus reducing redundancy during the build process.

Accessing Data Models

Data Models can be created and viewed from the blue header bar of the developer interface by simply clicking on Models (Figure 1).

Figure 1 – ‘Models’ button in the developer interface

This will show the Model Listing screen of all data models.

Figure 2 – The Model Listing, displaying all existing models within the current dictionary.

Data models are dictionary specific, meaning each dictionary will have it’s own list of data models.

The options on this screen include:

IconNameDescription
EditEdit the existing model.
ExploreExplore (run) the data model via m-Power’s Data Explorer. Useful if wanting to quickly query the data the model is built over*.
MenuCopy or delete the model, or modify the model’s existing properties

*You do not need to be licensed to the m-Power Data Explorer to explore models from the developer interface.

Creating Data Models

Building an m-Power Data Model is nearly identical to building an m-Power application. A developer will select the appropriate tables, fields, dimension fields, filters, and any calculations needed in the data set.

However it’s important to understand some key differences.

  • An m-Power application (ex. a Regular Report) produces a runtime output once built whereas a Data Model on its own does not have any standard output.
  • Changes to m-Power applications require recompiling to commit those changes; a Data Model does not ever get compiled, but rather changes to the model are simply saved in real time.

Important concept: A Data Model is merely a queryable dataset that once defined, is to be utilized within an application. Only once it is plugged in an application (for instance, via a dropdown) is the data from the model seen.

Walkthrough

Step 1. Model Information

Start by pressing “Create New Model” on the model listing page. The appropriate options in the window that appears are detailed below:

Figure 3 – Entering the model information when creating a new data model.

Model Number – A unique ID number that will be assigned to this model. Similar to the m-Power applications, this number will by default auto increment by 10, but may be changed only when creating the model.

Model Name – A descriptive name given to the model. Best practices are to give the model a name that any developer can immediately identify what information (data) this model is utilizing.

Description – Optional. A longer descriptive section to add any additional comments or information about this model. Will not be shown in the model listing screen (Figure 1).

Is Private? – If checked, other developer profiles will not be able to see or utilize this data model within the m-Power developer interface. This means the model will only be available to the developer who created it.

How would you like to create your data model? – Choose how the data model will get the data. Either utilize any existing database tables registered to the data dictionary (recommended) or upload an Excel spreadsheet into the database and utilize the table created from the spreadsheet.

Step 2. Tables/Fields

Figure 4 – Tables/Fields section of the data model.

Here you will be prompted to select your data. At the bare minimum one table (and at least one field from that table) is required. See here for the complete documentation on the Tables/Fields section.

Step 3. Dimensions

Figure 5 – Dimensions section of the data model.

Here you will be prompted to select a dimension field(s) for the model. A minimum of one selected dimension field is required before being able to proceed forward to Filters.

Selecting a field as a Dimension will control how the data set is stored at runtime. See here for the complete documentation on the Dimensions section.

After the required sections (Tables/Fields and Dimensions) are completed, the green Finish Model button at the bottom of the window may be clicked at anytime to complete the data model.

Step 4. Filters

Figure 6 – Filters section of the data model.

Here you will be given the opportunity to add any filters (hard-coded or runtime) to the data model. See here for the complete documentation on the Filters section.

The Filters section is optional and may be bypassed.

Step 5. Calculated Fields

Figure 7 – Calculated Fields section of the data model.

Here you will be give the opportunity to add any calculations to the data model. See here for the complete documentation on creating calculations.

The Calculated Fields section is optional and may be bypassed.

Step 6. Data Model Review

Figure 8 – Once the data model is finished, the developer will be brought to the Data Model review screen.

On this screen, the data model has been completed. From here, a developer can choose to immediately use the model in Data Explorer or for an m-Power application, if desired. The options from this screen are explained below:

Loads the model in m-Power’s Data Explorer tool for data exploration. Can be used to simply view the data or make saved chart and report designs for consumption in the Data Explorer.

This feature is not covered in the scope of this documentation. More information can be found here.


View and/or change any specific properties associated with this data model.

Most notably, the Max Web Records property will control the maximum limit of how records the model will return to the screen.


Selecting this will allow the developer to create a new application, with this data model serving as the basis for the new application’s model.

Once the application is created, it is no longer associated with the data model. Meaning, the individual application’s model (fields, dimensions, filters, calcs, etc.) can be changed without overwriting the dictionary data model.


Promoting to Production

Models can be promoted to production via the Promote to Production utility. When working in your promotion project, simply select the “Add Models to project” option from the Project Options pulldown menu in order to add any existing models to the promotion project.

Any models that have been added to the project will show in the Models tab (Figure 12).

Figure 12 – Adding data models to a project in the Promote to Production utility.

Once in the project, click the green “Select” button on each model in the project to add it to your promotion review.

The web.xml file will also need to be promoted to production if this is the first time promoting the data model.

Updated on August 29, 2024

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Contact Support