Creating indirect collections

<< Click to Display Table of Contents >>

Navigation:  Bizagi Studio > Experience design > Advanced topics >

Creating indirect collections


In order to make the most out of the My stuff menu, you may present to stakeholders different data sets which are product of either direct collections in the data model, or indirect collections, as described at My stuff.

While it may be most common and easier to use direct collections in My stuff, the potential of indirect collections relies on the fact that they do not need to be already designed in the data model to target a collection which is accessible more than one entity away.

Additionally, indirect collections allow you to include design-time filters to make sure you only display items from that collection with a given criteria.





Before you start, make sure you consider the following scenarios to identify when you can use an indirect collection:

Collection of data which is not directly bound to the stakeholder (e.g., collection of a collection, collection of a related attribute, or related attribute of a collection).

Reversed one-to-many relationship.


For a better illustration, the following examples elaborate on how to define an indirect collection when having a collection of a collection and a reversed one-to-many relationship.


1. Collection of a collection

A collection of a collection happens when the stakeholder has a collection of Entity A, which in turns has a collection of Entity B.




When an indirect collection is defined in this scenario, it is equivalent for the My stuff section to have the following relationship:




2. Reversed one-to-many collection

A reversed one-to-many collection happens when an Entity A has a related attribute relationship to the stakeholder.




This means, that the Related stakeholder reference has been defined as shown below:




When an indirect collection is defined in this scenario, it is equivalent for the My stuff section to have the following relationship:





You may also define a permanently reversed one-to-many collection, by editing your data model (one which does not apply only to My stuff).

The advantage of defining a permanently reversed one-to-many collection is that you can reuse it for expressions and forms.

For more information, please refer to the Relationships and reversing a related attribute.


Creating indirect collections

To define the XPath of an indirect collection,  go into the Expert view and click Entities.

Locate the Stakeholder entity and go into its Collections item.




Select the New indirect collection option, right-click the Collections node or selecting it directly from the ribbon.




Set a Name and a Display name for the new indirect collection. The Display name will be used in the Work Portal.




Once you press Next, a window with the navigable relationships is displayed. By default, the starting point is the current stakeholder (painted in blue).

The relationships shown in the right frame are the ones related to the entity displayed in green (or blue if any relationship has been selected).




Navigate through the relationships until the last entity be the one desired to relate.

In this example, notice that a Patient has many instances of Appointment, while each Appointment has 1 assigned Medical Center.




If the path has a collection, you can filter the final results, leaving only the ones related to the registries not filtered in said collection. To filter a collection, hover over the collection and select Add Filter.




A window will be shown prompting for a boolean filter. Set the filter and then select OK. More than one filter can be configured as long as the result is a boolean value.




When a filter has been applied to a collection, it will show a funnel icon with the number of filters it has. If hovered over, the current filters will be displayed.




Once finished, decide whether leaving repeated records, and then check/uncheck the option.




To save the new indirect collection click Finish.


In this example, we have correctly defined an indirect collection, allowing the Patient to view the records of all the medical centers he/she has been related to when an appointment has been rescheduled.





Indirect collections will not display the Filters nor the Order by options in the Work Portal, when accessed by the Stakeholder in My Stuff.

Filters are defined at design time but are not displayed to be changed at run-time.