Language Extensions
This section provides information about IYOPRO specific language extensions.
Working with Scripts
Aside from the Script task, many shapes allow you to assign Python code snippets to adjust process instance variables as desired.
If you have a lot of code and that in many shapes, this can quickly become confusing / difficult to maintain, the larger the process models become.
Then it will be more useful to centralize the code in one script and provide the code snippets as functions within the script.
In order to be able to do this, there is the Script as a separate file and the language extension ImportModule
to bind the Script in the shape.
First add a Script to your BPI-Project:
Type in a name for the script. This example uses "MyScript".
Edit the script and create your functions as desired:
To bind the script to the shape open the expression editor of the shape and type:
Using toast/pop-up notifications
If you want to get specific information to the user while they are completing a task, you can use toast notifications.
To generate toast notifications, you can use the following methods:
-
alert()
-
notify()
Both methods can be used to display a message. The difference is that the alert()
method throws an exception, thereby
stopping the execution of the script. The notify()
method only causes an attempt to display a message pop-up in the
user’s web client asynchronously.
In addition to a message, both methods allow you to set a title, an icon and a timeout. With the exception of the message, however, the other parameters are optional.
alert(string message, string title, string iconname, int timeout)
notify(string message, string title, string iconname, int timeout)
If you set a timeout, the toast notification will disappear after the defined time. Otherwise, it remains until the user clicks it away.
For the parameter iconname, you can use the icons available in the web portal. You can find an overview here: https://www.iyopro.com/iyopro/Icons.htm. The icon is displayed in size 24.
Typical icons may be:
error |
|
warning |
|
info |
|
help |
|
hint |
|
bell |
|
alert |
If you have an on-premises installation, you can also look up the existing icons in the icons directory of the frontend directory on the server on which your IYOPRO is installed. A long as you follow the naming scheme there, you may also add your own icons.
Proceed
proceed()
can be used as a special replacement for return
as well as in place of Result
.
The Python return statement is a special statement that can be used within a function or method to terminate the
function call and return the result of the function back to the caller.
However, there is no such call in the script expressions of the controls. A return statement cannot be used here.
However, the use of return
is advantageous, e.g. for case distinctions, since otherwise you would have to work with nested statements.
The proceed statement allows you to use it like return
, except that proceed()
cannot only be used within a function.