Skip to main content
Version: 2024

Tasks

Introduction to tasks

A task is a piece of 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. In that case, the task is called a table task. 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.

This tab contains a task that takes you to the Code overview for the selected task. See Go to a related screen for an object.

Set up a task

Setting up a task consists of the following steps:

  1. Create a task
  2. Set up task parameters
  3. Optional: Create task look-ups
  4. Optional: Add conditional layout
  5. Set up table tasks
  6. Connect table task parameters
  7. Optional: Add functionality

Create a task

To create a task:

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

  1. Enter a Task name.
  2. Select the Task logic type. The following task types are supported:
    • Template: this is the default value, which creates a stored procedure on the database.
    • Windows command: this can be used to call an external program or to open a network or web address. For more information, see Windows command tasks.
    • GUI code: allows for 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.
  3. If the Task logic type is 'Template', you can select if it should use an Atomic transaction. For more information on atomic transactions, see Subroutine - Atomic transaction. For more information on how to use this in code, see Weave code into atomic tasks.
  4. To use a badge, select the checkbox Show badge. For more information, see Badges.
  5. Optional: change the Generation order no. Only change it to ensure that the tasks with interdependencies are executed in the correct order.
  6. Optional: select a keyboard shortcut which can be used to execute the task. Make sure that the screen does not contain multiple tasks using the same shortcut. Also do not use a shortcut that is already used by the GUI, such as Ctrl + R. For more information, see Shortcuts (used by GUI's). Validations are in place to prevent you from selecting such shortcuts.
  7. If the task should Ask confirmation before executing, select the corresponding checkbox. You can select a confirmation message. Otherwise, a default message will be shown. The task is executed when a message option with a status code of zero or higher is chosen. See also, Message options.
  8. 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. Without visible parameters, the task will be executed automatically. Universal GUI - It is not possible to abort this flow.
  9. Select an option from the drop-down Await result on how to deal with tasks that take a long time to process.
    • 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. Web GUI - this means that the long-term actions will not cause a request timeout from IIS (default after 90 seconds).
  10. Select the Display parameter to distinguish between multiple instances of a task in the async action dialog.
  11. Optional: if the task should be Offline executable, see Offline available tasks for more information.
  12. Optional: if the task should Repeat after execute, see Repeat a task after execution for more information.

Settings when creating a task

Set up task parameters

After you created a task, you can add parameters that define the input values for the task. Parameters are in a specific sequence and linked to a domain for the data type and the control.

To set up a task parameter:

menu Processes > Tasks > tab Default > tab Task parameters > tab Form

  1. Enter a Task parameter name.
  2. Select a Domain, which determines the data type and control of the field (ID).
  3. Specify if the task parameter should be Mandatory.
  4. Optional: change the Case type, for example to Upper case.
  5. Optional: you can provide a Default value for the task parameter.
In the field Default value type, you can select a Constant value or an Expression:

  • Default constant value - A fixed value that is filled when adding a record. With a change, this value is not filled.
  • Query - The expression used to determine the default value. The query cannot use values from the other task parameters.

For the following functions, the Software Factory will not generate a function but instead use the given Query as the default value. To use these functions as a default value query, you should specify them without select.

  • newid()
  • getdate()
  • getutcdate()
  • sysdatetime()
  • dbo.tsf_user()
  • dbo.tsf_original_login()
  1. Format the task parameters. The following fields are available:

    • Column type
    • Sequence no
    • Label width (px)
    • Field width (px)
    • Field height in positions
    • Field no. of positions further
    • Field in next group
    • Field in next column
    • Field on next tabpage

Settings when setting up a task parameter

Create task look-ups

This is an optional step. By creating a task look-up you can determine in which table the value for a task parameter should be looked-up and entered.

To create a task look-up:

menu Processes > Tasks > tab Default > tab Task look-ups > tab Form

  1. Select the look-up Table.
  2. In field Look-up control you can indicate for each field whether the look-up presentation field has to be displayed with a combo box, a pop-up window or both. If the look-up table is displayed with a pop-up window, this can be the standard, but a variant can also be displayed.

Settings when setting up a task look-up

Then, create the look-up columns:

menu Processes > Tasks > tab Default > tab Task look-ups > tab Look-up columns > tab Form

  1. Select a Task parameter.
  2. If a Column with the same name as the task parameter exists, it will automatically be filled. Otherwise, you must select it manually.

Settings when setting up a task look-up column

Add conditional layout

menu Processes > Tasks > tab Conditional layout

This is an optional step. Just as with columns, you can give task parameters a background color or a different font. You can use this to draw the user's attention to a specific task parameter. 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.

Settings when setting up a task conditional layout

Add functionality

This is an optional step that depends on the task logic type.

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.

Weave code into atomic tasks

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

Display progress from a stored procedure

When performing long-running tasks or tasks in combination with multi-selection, a progress dialog 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]*;
  1. Fill the Message ID: optional parameter, use it to change the text above the progress bar (default: Run task...) by the translation of a message_id.
  2. Fill the Parameter string: optional parameter for filling parameters in the translation if you are using a specific message_id. It is also possible to use translations of model objects, such as columns or tables.
  3. The progress in percentages. By setting the percentage to -1, the progress bar remains in the marquee position.

An example when executing a stored procedure from SQL Server is:

exec tsf_send_progress 'copy_customer', '<text>Thinkwise</text>', 82;

Set up a table task

A table task is a task that is linked to one or more tables. In these tables, the task is displayed in the ribbon, the context menu, and possibly the task bar.

Create a table task

To link a table to a task:

menu Processes > Tasks > tab Table tasks > tab Form

  1. Add the Table and Task.

  2. To group tasks for a more logical display, select a Task group. 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.
  3. To enable the table task when no records are present on the screen, select the checkbox Enable for empty subject.

note

The default for field Enable for empty subject is set in the menu Models > Model overview > tab Branches > tab Model settings.

  1. To enable immediate task execution by double-clicking on an item, select the checkbox Double click on record. For more information, see Configure a double-click task.

  2. You can change the Display type to allow customization of how the task is presented.

    • Universal GUI - If there is enough space, the presentation will be according to the selected type. If not, the task will be shown in the overflow menu.

    For example, Icon + text (> text > icon) means that the task is displayed as an icon with text. On a smaller screen with less space, it is displayed as text (the first fallback, > text). With even less space, it is displayed only as an icon (the second fallback, > icon). The overflow menu is always the last fallback type, except for the display type Hidden.

    • Windows GUI Web GUI - The following options are supported:
      • Hidden - The task is not shown but can be started with a keyboard shortcut, a double-click task, or a process flow.
      • Overflow - The task is not shown in the button bar but is shown in the ribbon menu and context menu.
      • In all other cases, the task is shown in the button bar, the ribbon menu, and the context menu. On a smaller screen with less space, it is moved to the overflow menu.
  3. 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 lookups and details.
    • Document - the user interface will refresh the main subject, including all lookups and details.
  4. To change the subject's task order, you can change the Sequence no.

Table tasks Settings when setting up a table task

Connect table task parameters

After linking a task to a table, connect the table columns to task parameters:

menu Processes > Tasks > tab Table tasks > tab Table task parameters

  1. Select a Task parameter. The active record's field value is passed on to the parameter as a default value.
  2. If a Column with the same name as the task parameter exists, it will automatically be filled. Otherwise, you must select it manually.

Table tasks Settings when connecting table task parameters

You can link a task directly to a table as explained before (see Create a table task).

This is also possible at subject level, in that case you link en existing task to an existing table:

menu User interface > Subjects > tab Overview

See Link a task to a table in the Subjects guide.

Configure a double-click task

It is possible to enable immediate task execution by double-clicking on an item. This setting works for grid, card list, grouped tree, and resource scheduler items.

  • For the Web GUI, a double-click task is always visible in the toolbar.
  • The Universal GUI and the Windows GUI support different presentations for double-click tasks with the Display type option.

In addition, you can bind the task to a specific column. This can significantly improve the user experience because it allows each column in a grid to start a different process or handle specific data.

To configure a double-click task:

menu User Interface > Subjects > tab Default/Variant > tab Links > tab Tasks

  1. Select the task that you want to link to the table.
  2. Select the Double click on record checkbox.
  3. In the field Double click column, select a column from the table. You can override this column choice in a table variant or leave it empty. This transforms the cell-based double-click task into a row-based double-click task in the specific table variant and vice versa.

Configure a double-click task

Copy a task

To make a copy of a task:

menu Processes > Tasks > tab Settings

  1. Execute the Copy task copy task.
  2. Enter a name for the copy in the field To task.
  3. Select what you want to include in the copy:
    • Table tasks - Include the links to one or more tables. See Table tasks.
    • Functionality assignments - Include the functionality assignments. If you deselect this option, the copied task will not be assigned to any control procedure. Use this to create a bare object (the copied task). Then, create a new control procedure, and assign the copied task to it.

copy task Copy a task

Add a task to a menu

menu Processes > tasks > tab Menu

A task can be included in several menus. If a task is linked to a table, it appears 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, you can immediately start the task without first having to open a screen.

Create a task variant

menu Processes > tasks > tab 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 layouts than the default. For more information on variants, see variants.

Set up special tasks

Drag-drop

Using drag-drop, you can allow users to drag records from a grid or tree to another or the same subject. When the user drops an item on that table or row, the drag-drop task is started.

To configure drag-drop:

  1. Set up a drag-drop task. Before you can select a task as a drag-drop task, you must first create that task through the regular process. See also, Set up a task.
  2. Set up the Drag-drop links. What makes a task a drag-drop task is not determined by any setting within the task itself, but rather by its configuration as a drag-drop task on that screen.

Windows command task

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

Universal GUI Example: Use a Windows command task to open a URI

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 task Windows 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.

Offline available task

Universal GUI

If the connection is lost, a user is requested to close their work and continue offline. For more information, see the Universal user interface guide: Menu tasks in offline mode.

Restrictions when working in offline mode:

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

To make a task available for offline execution:

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

  1. Select the checkbox Offline executable.
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.

Task which repeats after execution

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

It is possible to specify that, after executing the task, the task pop-up should 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.

To repeat a task after execution:

  1. Select the checkbox Repeat after execute.

Was this page helpful?