Breakpoints
Problem
What do I have to do in order to use breakpoints in Appway's script language?
Solution
First, enable breakpoint support in the configuration by setting the configuration property nm.breakpoints.enabled to true:
- In the Appway Studio, go to System Configuration > Configuration Properties
- Open the page context menu and select Edit Server Configuration
- Add a new line to the server configuration:
nm.breakpoints.enabled = true - Click on Save and then on Close
Changing this configuration property has an immediate effect. You do not need to restart Appway. You may have to close and reopen a Business Object editor or Script editor before you can use breakpoints in it.
You can set breakpoints in the Script language and on Process tasks.
Script Language
To set a breakpoint on a line of script code, click on the line number. A small red dot appears next to the line number. This indicates that there is a breakpoint on that line.
If you click on the dot, the breakpoint is disabled. If you click on the dot again, the breakpoint is deleted.
Breakpoints in Script Code
Breakpoints are not supported in every location where you can use script code.
You can set breakpoints in ...
- Script Functions
- Data Class functions
- Script Tasks in a Process
- Properties of Process elements, Screen components, Catalog sources and filters, and Rule components
You cannot set breakpoints in ...
- Variable definitions and assignments
- Properties of PDF Output components, PDF Output Table components and Integration Link components
- Access Policy expressions
Process Task
If you right-click on a Process task, the context menu shows you commands to add, enable/disable and remove a breakpoint on this task. A breakpoint on a task triggers when a token reaches this task.
Managing Breakpoints and Debugging Code
If you set a breakpoint in Script code or on a Process element, you do not have to save the Business Object. Breakpoints are not stored as part of the Business Object model. As a result, breakpoints do not get deployed with an export/import procedure. If Appway is stopped, all breakpoints are automatically disabled, but not deleted.
You can get an overview over all existing (active and disabled) breakpoints under Solution Maintenance > Processes > Script Language, on the Breakpoints tab:
In detail, the following information is available:
- The menu in the top left provides access to bulk operations, like enabling, disabling, or canceling all breakpoints, or resuming or canceling all sleeping threads.
- The Breakpoint Definitions table shows all existing breakpoints. Use the context menu to enable, disable, or remove the breakpoint, decide if it should be triggered for all users instead of just for the user who created the breakpoint, or open the according Business Object editor.
Note: Before setting a breakpoint to trigger for all users, take this fact into account: If the breakpoint is set in a frequently used element (e.g. in a Screen Component in the main template), this can disrupt other users working and testing on the same system.
-
The Triggered Breakpoints table shows all the breakpoints which are currently blocking execution and are waiting for inspection and/or release. Use the context menu to resume or cancel execution, or to inspect the breakpoint using the Inspector tool. The Inspector tool allows you to view execution details and Step Over, Step In, or Step Out of code in places where breakpoints have been set, allowing you to debug your code: