A task represents business logic that can be executed manually by the user. A task can be linked to one or more tables and will be displayed in the ribbon, the context menu and possibly in the task bar. Columns of the table can be linked to the parameters of the task. The values of the linked columns of the active record are then passed on to the relevant parameters.
An example task pop-up
In addition, a reference can be established from a parameter to a look-up table. In this way, a parameter gets a drop-down list and a button in order to be able to select another value in the pop-up.
A task has a default and a layout mechanism, just as a table. A shortcut combination can also be defined with which the task can be started using the keyboard.
Creating a task
When creating a new task, you have to select the type of task to be created. The following types are supported in the Software Factory:
- Windows command
- GUI code
This is the default value, which creates a stored procedure on the database.
Tasks can be used to call an external program or to open a network or web address. The location of the external program, the network or web address have to be entered in the Object name field. Any parameters that are added to the task will be passed on to the call of the external program. However, this only works with external programs and not with network or web addresses.
To start Paint for example, enter the program name mspaint.exe in the object name and add a filename parameter to open that file.
Or create your own batch file to print a PDF document:
@CALL START /MIN AcroRd32.exe /N /T %1
With the use of parameters, it is also possible to create dynamic external program tasks. This can be used in situations in which the external program, network or web address to be opened is not always the same but changes depending on the situation. In these cases, a parameter has to be added to the task with the location of the external program, network or web address. The task parameter ID of this parameter has to subsequently be specified between square brackets in the Object name field of the task (e.g., [URL]). For dynamic external program tasks, all other parameters are ignored.
To open a dynamic URL without knowing the default browser, you can trick the task by using 'http:' as Object name and set the first parameter to the URL to be opened. The same goes for other URI schemes like 'mailto:'.
This options allows custom C# tasks, such as the TSFtaskMailer, to be linked in. The name of the custom task should be entered in the Object ID field.
Represents a dummy task which can be used in a process flow or to display a form.
If Ask confirmation is checked, a message can be selected that is displayed before executing the task. The task is executed when a message option with a status code of zero or higher is chosen.
Task with confirmation message
When performing long-running tasks or tasks in combination with multi-selection, a progress dialogue is displayed. In addition, the progress percentage can also be displayed from (SQL Server) stored procedures while a procedure is being executed.
Progress Percentage of executing a task
To display the percentage, the procedure 'tsf_send_progress' should be called from the SQL code:
tsf_send_progress [message id], [parameterstring], [percentage]
Optional parameter with which text above the progress bar (default Run task...) can be changed by the translation of a message_id.
Optional parameter with which parameters in the translation can be filled when use is made of a specific message_id. It is also possible to use translations of model objects, such as columns or tables. For more information, see paragraph 8.2.
For example, for SQL Server:
exec tsf_send_progress 'copy_customer', '<text>Thinkwise</text>', 82;
The progress in percentages. By setting the percentage to -1, the progress bar remains in the marquee position.
Tasks can take a long time to process. There are four options to give instructions about what to do with these tasks.
Task with await result options
- Yes - The user has to wait for the result and a progress indicator is shown.
- Yes (no progress indicator) - The user has to wait for the result (the GUI freezes and hourglass is shown).
- No - The action is executed in the background and the user can continue working.
- Optional - The user has to wait (option 1) but has the possibility to continue the action in the background (option 3). Reports executed in the background can be monitored in the Async action dialog.
For Web, this means that the long-term actions will not cause a request timeout from IIS. (Default after 90 seconds)
The display parameter can be used to distinguish between multiple instances of a task in the async action dialog.
Template-based tasks can be set to run as an atomic transaction. See Subroutine - Atomic transaction for more info.
You can weave your own code into the
catch part of atomic Tasks. The catch part has been separated into two templates, allowing templates to be weaved
in-between. You could use this, for example, to weave code for logging.
menu Business logic > Functionality > tab Assigning > tab Available templates > tab Assigned templates
Example: add your own code in the
Offline available tasks
Only available as of the Thinkwise Platform release 2021.2.
When the connection is lost or unavailable, your users can still use tasks from the menu. Working offline could be necessary, for example, for a maintenance engineer working in the basement or a ship crew at sea.
If the connection is lost, a user is requested to close their work and continue offline. Switching between online and offline mode will reset the Universal GUI.
At the same time, the menu is disabled, but tasks flagged as Offline executable remain available. Restrictions when working in offline mode are:
- The tasks cannot contain lookups/domain/file controls.
- The tasks will check for mandatory fields but make no other validations.
- The tasks will not execute application logic for parameter input. This will be done later when the user is online again.
- The task control procedures should accept all input without throwing errors since a user cannot fix these when synchronizing afterward.
An indicator next to the menu shows the state of the connection.
- State: offline.
- State: online without changes.
- State: online with pending changes.
After the connection has been restored, the Universal GUI will not reconnect automatically. Instead, the user needs to 'Reconnect' manually. At that moment, all offline executed tasks and their input will be synchronized, including canceled task actions. While synchronizing, a progress page is shown. After that, the Universal GUI is built up from scratch.
See also, the Universal GUI user manual.
After creating a task, parameters can be added to the task that define the input values for the task. Parameters are in a specific sequence and are linked to a domain for the data type and the control.
Parameter settings when creating a task
Task parameters can be formatted in the same way as forms of tables are formatted. Column type, sequence number, label width, field width, field height, number of positions further, field in next group, field in next column and field in next tab are available for this.
By specifying a task reference (between task and table and corresponding column comparison), it can be determined in which table the value for a field should be looked-up and entered.
Just as with columns, the task parameters can be given a background color or a different font. Since a task does not have a grid, this will only be applied to form parameters.
More information on conditional layouts can be found here.
You can link a task to one or more tables. In these tables, the task displays in the ribbon, the context menu and possibly the task bar.
menu Processes > Tasks > tab Table tasks > tab Form
- Add the Table and Task.
- To enable the table task when no records are present on the screen, check the Enable for empty subject box.
The default for field Enable for empty subject is set in the menu Projects > Project overview > tab Project versions > tab Form.
To enable task execution by clicking twice on a row, check the Grid double click box.
To control the performance, you can configure the Refresh behavior after specific actions:
- None - the user interface will not refresh any data.
- Row - the user interface will only refresh the current row.
- Universal GUI For Universal GUI, 'Row' is not fully supported. Instead of the row, this option refreshes the entire subject.
- Subject - the user interface will refresh the current subject including look-ups and details.
- Document - the user interface will refresh the main subject including all look-ups and details.
After linking a task to a table, connect the table columns to task parameters in the tab Table task parameters. The active record's field value is passed on to the parameter as a default value.
menu Processes > Tasks > tab Tasks > tab Table tasks
Table tasks can be grouped together to display them logically. Both the groups and the tasks within a group can be put in a sequence. When tasks are grouped, they can be displayed in two ways in the context menu:
- Through a sub-menu.
- Separated by separators.
Grouping table tasks
A task can be included in several menus. If a task is linked to a table, it will appear in the ribbon and the context menu of this table. A task can also be included in the quick launch bar, a tree view or a tiles menu. In this way, the user can immediately start the task without first having to open a screen.
When generating, a program object is created for template-typed tasks. The associated default and layout program objects are also created. The application logic can be modelled and described in the Functionality screen.
Using task variants, it is possible to design alternative user interface views of a task. A task variant can, for example, have a different icon and translation, default values and conditional formatting than the default. More information on variants here.