Advanced configuration using Group by

<< Click to Display Table of Contents >>

Navigation:  Bizagi Studio > Process wizard > Model Process > Modeling for execution > Sub-Processes > Reusable 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 Reusable option.

Configuremultiplesubprocesswithbasics1.1.

 

2. A properties window will automatically display. Tick the Multiple check box control and select the process to be transformed from the Process drop down list. In this example we select the process Students Enrollment.

 

Configuremultiplesubprocesswithbasics11

3. Select the Multiple tab. Once selected:

Define the collection for the Sub-Process grouping. To do so, click the Xpath to Collection browse button. In this case we group by StudentsApplication.StudentsEnrollments collection.

Select the Number of instances drop down list. In this example we  will select the Items in Collection option.  

A relationship must be defined between the collection StudentsEnrollments entity and the current Sub-Process entity. Click the Related Entity creation button to establish that relationship automatically. 

Configuremultiplesubprocesswithbasics12

4. Tick the Group Check box control and select the attributes by which you wish to group from the Attributes in Collection box. Drag and drop the attributes to the Attributes to use in Group box. To remove an attribute tick its Check box control. We will group by Gender.

To define the collection to be grouped, in this case the collection StudentsEnrollments a relationship must be defined between such entity and the current Sub-Process entity. Click the Group in Collection button to establish that relation automatically.

 

Configuremultiplesubprocesswithbasics16

 

 

 

 

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.