Advanced configuration using Group by

<< Click to Display Table of Contents >>

Navigation:  Bizagi Studio > Process wizard > Model Process > Modeling for execution > Sub-Processes > Understanding Multiple Sub-Processes > Advanced configuration for Multiple Sub-Processes >

Advanced configuration using Group by

To illustrate the Group by feature we will use the Students Application Process described in previous sections.

 

In a school, several students have to be enrolled in order to assist to class. The applications of the students must be received and then an enrollment Process should be created: one for each student. The business situation can be modeled as shown in the following diagram:

 

Configure multiple subprocess1

 

 

There is a parent Process called Students Application and a multiple Sub-Process called Student Enrollment.

 

Both Processes have been diagrammed in the Process Modeler and Process Entities defined for each one.

Students Application is the Process entity of the Students Application Process and the Students Enrollment by Gender entity is the Process entity of the Sub-Process Students Enrollment.

 

In order to create the Multiple Sub-Process instances a collection is defined for the parent Process. This collection is called Students Enrollment

 

 

Configure multiple subprocess with basics10

 

We wish to manage the enrollments by gender, accordingly we will create a Student Enrollment Sub-Process instance for boys and another Sub-Process for girls as shown in the image below.

 

Configure multiple subprocess with advanced2

 

To group instances of this Sub-Process by gender follow the next steps:

 

1. Go to step 1 (Model Process) of the Process Wizard and click Edit Process.  Select the parent Process called Students Application.
In the model diagram, right-click the Task you wish to convert, in this case Students Enrollment, and select the option Transform to sub-process option.
A new window will display the Sub-process types. Select the Multiple option and click Next.

 

Configure multiple subprocess with basics1

 
2.  Select the process to be transformed, Student Enrollment, from the drop-down list, choose the version and click Next.
Once the associated diagram to the Sub-process has been selected, choose the Advanced settings option and click Next.

 

Configure multiple subprocess with advanced1

 

3. Select the collection for the Sub-process grouping. In this case we group by StudentsApplication.StudentsEnrollment collection.

Also select the number of instances. We will determine  the number of instances to create using a collection.  Select the Items in Collection option.

 

Configure multiple subprocess with advanced3

 

4. In the last window of the Wizard, select the option Group by. The wizard will ask you to define the collection to be grouped, in this case the collection StudentsEnrollment. Once it has been defined, the Wizard will advise you that a relationship must be defined between such entity and the current Sub-Process entity.

 

 

Configure multiple subprocess with advanced6

 

Click Yes to establish that relationship automatically. Then click Next 

 

 

Configure multiple subprocess with advanced4

 

 
5. Select the attributes by which you wish to group. Select the attribute from the box on the left and then click the right-pointing arrow to add it. To remove an attribute select the it from the box on the right and then select the left-pointing arrow.

We will group by gender. Click Next 

 
Configure multiple subprocess with advanced5

 

Relationship to the parent Process

When you execute the Process you will find that it is not possible to access the parent Process' information since no automatic mapping is done. This means, that there is no relationship between the Sub-Process entity and the parent Process entity. There are relationships between the parent Process Entity and the grouped entity and between the Sub-Process Process entity and the grouped entity.

 

 

Using groupby8

 

 

It is necessary to define the missing relationship to be able to navigate all the data model and be able to reach the parent Process Process Entity.

 

 

Using groupby9

 

In order to define the missing relationship between the parent Process Entity and the Sub-Process Entity follow the next steps:

 

1. Go to the second step of the Wizard and click Model Data for the parent Process.

 

Using groupby10

 

 

2. A new window will display. Right-click the Sub-Process Process entity (Students Enrollment by Gender) and select the option Edit Attribute List.

 

 

Using groupby11

 

3. Create a new attribute clicking on Add and typing the display name. Select the parent Process Entity to be related.

In this case we type Student Application and select the Student Application Entity from the Master entities list.

 

 

Using groupby12

 

4. The missing relationship is established and the data model updated.

 

 

Using groupby13

 

5. Now it is necessary to create an expression that enters the necessary data to the new relationship.

Define an on enter expression on the first Activity of the Sub-Process. It will get the ID of the parent Process Entity and set it in the Sub-Process entity.

 

The expression in this example would be:

 

var idParent=<StudentsEnrollmentbyGender.StudentsEnrollment[1].StudentsApplication>

<StudentsEnrollmentbyGender.StudentApplication>=idParent

 

Configure multiple subprocess with advanced7

 

With the relationship created and the mapping expression you will be able to access to the data of the parent Process context normally through the Student Application Relationship

 

Using groupby14

 

note_pin

To group Sub-Process instances take into account that the Process entity of the multiple sub-process and the collection must be different entities.