How to Build Your First PAK Workflow
1. What You Will Learn
After finishing this tutorial you will be able to create your first simple workflow with the PAK Workflow Editor. You can download the editor here.
3. Editor Overview
3.1. First Start
When starting the PAK Editor for the first time, you will see two buttons on the left side of the window.
New BPMN(1): Here you can open a new empty BPMN.
Open BPMN(2): Here you can open an existing BPMN from your filesystem.
3.2. Overview
After creating a new BPMN, the Editor loads all possible commands, control elements and a graphical representation of the workflow.
The editor ist divided in three sections:
-
Control Elements and Custom Commands Palette: All imported commands and the workflow control elements are available in this section. The type and amount of the commands differ depending on commands you have added to your editor in Preferences → Commands.
-
Graphical representation of the workflow: In this section you are able to create your workflow while drag and drop the commands and control elements to any place in this section.
-
Analysing Tabs: In these tabs you are able to analyse your workflow, edit the datastore and analyse the usage of the different variable keys in the workflow.
4. Build the First Workflow
It’s time to build our first workflow. For the first practice we simply want to open a text file on our filesystem.
On the Workflow tab (1), initially only the “Start” circle (2) exists in a new workflow. This is our entry point for the workflow, which means that the workflow starts at this point. To add an element after this starting point, click on it so that it is highlighted blue.
4.1. Adding a Command
On the commands palette (1) we can see different command groups. By clicking on the Generic group, we can see different commands and subgroups. One subgroup is the File subgroup, which contains commands for most generic file operations. In the File group we can find the command “Open Text File” (2). This command is exactly what we need. While hovering over this command we can see a silhouette (3) on the workflow, where it will be added. The new command will have a direct connection to the element we marked before. In our case the entry point. We have also an explanation of the command with its possible input and output variables (4).
Finally, we can click on the command name and the command will be added to the BPMN.
If you don’t see the preview while hovering over the command name, or the command is not directly connected to the entry point, you have first to click on the entry point, that it is marked by a blue circle. |
4.2. Configure a Command
After the command is added to the BPMN, we can configure the command by clicking on it. On the right side of the window the Properties of the command are shown. We have now the opportunity to give the command a custom name (1), select a version of the command (2) and define its input and output variables.
If no command version is selected. The newest version will be used. |
Now, we can add the path to a file we want to open. In the command description in Command Preview we have already seen the possible variables of the command. It just has one input variable, which needs a path to a file. By clicking on the “+” button (3) in the Properties window, next to the Constants & Mapping header, we can add this key for the path. More details for the mapping are described in the Basic Mapping Guide.
We can now decide which key we want to configure in the corresponding dropdown field (4). In our case the pathToFile
key is the only option, so we can’t choose another key.
After choosing the correct key, we can decide which mapping we want.
-
Constant Mapping (5): With the constant mapping a static constant value such as a Text or a Number can be defined.
-
Key Mapping (6): A key mapping defines a datastore entry to the given key. This can also be an object.
For our scenario we can use the constant mapping and give the path as a String (7).
4.3. Finishing the Workflow
Now we have all operational commands that we need for our workflow scenario. But yet, we are not finished.
We can see an error on the Dataflow Analysis Tab. The dataflow analysis calculates all connections between the commands and control elements. It secures that all keys are mapped correctly and that all paths through the workflow has a beginning and an ending.
For fixing this error, we just need to add an end event in our BPMN. For this we select End Event (2) in the workflow control elements section and add the circle anywhere on our BPMN. After adding the event, we just need to connect the end event with our Open-File-Command by an Edge (1). You can find the edge in the workflow control elements section, too.
After all elements are connected properly a small green check mark (3) appears in the Dataflow Analysis Tab.
The dataflow analysis should work automatically as default. It is also possible to deactivate the automatic analysis task on Workflow→Analyse Automatically and analyse the workflow on demand. |
5. Saving the Workflow
After adding our end node to the workflow, we can now save the BPMN. The “*” symbol on the top of the BPMN editor indicates that the workflow is not saved currently. With File → Save we have the option to save our BPMN on a .bpmn-File to the drive. For executing the BPMN you need a runner application.
6. Summary
In this tutorial we learned about defining a simple workflow, which executes a command. We have learned how to design the BPMN and adjust the properties of commands.
In our next tutorial we will learn about human interaction with the workflow and exchange information between the commands with the datastore.