Troubleshooting m-Power Applications
Debug SQL Statement
Occasionally, m-Power developers need to better understand why their m-Power applications are not working as expected. At our technical support hotline, we’ve noticed that two issues come up frequently: Generated applications are not returning the anticipated record set and Dashboard applications do not render as anticipated. To help with these types of issues, m-Power ships with two useful debugging options.
Method 1:
debug=1
When the application is run, you can see the exact SQL statement used by m-Power to generate the query returned to the screen. Developers can also see a list of any parameters that are being sent through the form submission.
To activate our basic debugging option, developers have two options:
Option A: Go into Application Properties and set the debug option to “Yes”. Debugging will now remain on, until this option is changed back to No.
Option B: An alternative method to activating this debugging option is to forgo setting the application property and instead add ?debug=1 to the end of your URL. Doing so will turn on the debugging logic only for this single visit. Once the developer has navigated away from this page, they will lose their debugging feature.
In either case, the SQL statement can now be analyzed for accuracy.
Method 2:
debug=2
This advanced debugging method is extremely helpful to users creating powerful dashboard applications. To better understand dashboards, they are a collection of a single parent application, and multiple child applications. The child applications are usually referenced in the parent via an import statement.
By applying debug=2 to the URL, the developer’s dashboard will change dramatically. Rather than rendering each individual child application, the page will instead replace the rendered child app with the URL used to call this child app. This is extremely helpful when a dashboard is not behaving as you would expect and you want to verify that you are calling the correct application and passing the right parameters.
With the help of debug=1 or debug=2, an m-Power developer can debug many issues that he may run into when building his applications. Try it out and let us know what you think!
Runtime Parameter Listings
Using the URL to call applications can be very helpful when developing applications, especially when using links. However, sometimes knowing which parameters are available for your application can be difficult to remember. The August 2015 release of m-Power includes a runtime parameter listing that will list available global web parameters as well as template specific parameters that you can use with your application.
Included in this new feature is the ability to build and execute the URL with the parameters you choose. The parameter listing page will pull in the fields directly from your app specs and apply them to the available parameters. Instead of showing you "S_[INSERT_FIELD_HERE]=1", there will be options for the fields that apply to that parameter(e.g. S_CUSNO=1, S_CNAME=1, and so on). Simply clicking on the desired parameter will add it to the running URL being generated at the top of the page.
To launch this feature, simply add ?help=1 to the end of the URL and hit Enter.
You will see the template and current URL from the application. The first tab includes a listing of all general parameters with a description, valid values, default value and an example of the parameter being used. Clicking a parameter's name will add it to the running URL at the top. If parameter value is dynamic, simply enter the desired value into the text box. If the parameter value is limited to set values, choose the desired value from the dropdown. To remove a parameter, click on the red 'X' in the running URL. Clicking "Run URL" will execute the URL you've created. The ?help=1 parameter will be dropped when executing the URL.
The second tab is a listing of all parameters that are specific to the template being used. Clicking on the available parameters will add them to the running URL as well.
Release Notes:
Applications compiled prior to the August 2015 update will only have the generic parameters available. The app will need to be recompiled before the template specific parameters will be available.
The parameter listing only supports standard templates that are shipped with m-Power.
Some parameters are dependent on other parameters being included in the URL. If this is true with the parameter you choose, the dependent parameter(s) are appended as well.
All parameter values need to be URL-encoded in order to work correctly. If there is a value that is not URL-encoded, you will receive an alert when trying to execute the URL.