Skip to main content
Version: 2022

Tasks

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:

  • Template
  • Windows command
  • GUI code
  • None

Template

This is the default value, which creates a stored procedure on the database.

Windows command

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:'.

Example: Use a Windows command task to open a URI

Universal GUI

menu Processes > Tasks > tab Tasks > tab Settings > tab General

  1. In the Task logic type field, specify 'Windows command'.

  2. In the Object name field, specify the URI to open.

    Windows command taskWindows command task opening a URI

When executing this task, the corresponding URI is opened in the browser. You can also use dynamic URIs via task parameters. In that case, the Object name field must contain the task parameter id between square brackets: [task_parmtr_id].

Please be aware of the following limitations:

  • This implementation only supports opening URIs and not executing Windows commands.
  • Windows command tasks cannot be used in process flows.

GUI code

This task logic type 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.

None

Represents a dummy task which can be used in a process flow or to display a form.

Task confirmation

menu Processes > Tasks > tab Tasks > tab Settings > tab General

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

Progress

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]

Message ID

Optional parameter with which text above the progress bar (default Run task...) can be changed by the translation of a message_id.

Parameter string

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;

Percentage

The progress in percentages. By setting the percentage to -1, the progress bar remains in the marquee position.

It is possible to execute tasks on multiple rows, with a popup for each row. This allows a user to provide input for each row.

  • Universal GUI - It is not possible to abort this flow.

To activate a popup for each row:

menu Processes > Tasks > tab Tasks > tab Settings > tab General

  1. Select the Popup for each row checkbox.

Await result

menu Processes > Tasks > tab Tasks > tab Settings > tab General

Tasks can take a long time to process. There are four options to give instructions about what to do with these tasks.

await_result 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.

Atomic transaction

Template-based tasks can be set to run as an atomic transaction. See Subroutine - Atomic transaction for more info.

Processes > Tasks > tab Settings > tab General

  1. Select the Atomic transaction checkbox.

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

Assigned templates Example: add your own code in the catch part

Offline available tasks

Universal GUI

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.

  • offline State: offline.
  • online no change State: online without changes.
  • online pending 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.

tip

You can use two extended properties for additional functionality when working offline:

  • RepeatOfflineTasks repeats a task after execution when offline.
  • HideOfflineTasksReadonlyParameters hides all read-only task parameters when offline.

See also, the Universal GUI user manual.

Repeat a task after execution

menu Processes > Tasks > tab Default/Variants > tab Settings > tab General > group User interface

To repeat a task after execution, select the Repeat after execute checkbox.

After executing the task, the task pop-up will automatically reopen. You can use this setting, for example, for bar code scanners and task execution after scanning a product. By repeating the task, a user can continue scanning products without manually reopening the task pop-up.

Task parameters

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.

Look-ups

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.

Conditional formatting

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.

Table tasks

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

  1. Add the Table and Task.
  2. To enable the table task when no records are present on the screen, check the Enable for empty subject box.
note

The default for field Enable for empty subject is set in the menu Projects > Project overview > tab Project versions > tab Form.

  1. To enable task execution by clicking twice on a row, check the Grid double click box.
    For Universal GUI, this setting will hide the task in the toolbar.

  2. 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.
    • 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.
  3. 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.

Table tasks Table tasks

Grouping tasks

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 tasks 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.

Functionality

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.

Variants

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.

Was this page helpful?