Counting the number of elements in an entity

<< Click to Display Table of Contents >>

Navigation:  Bizagi Studio > Process wizard > Business Rules > Business Rules examples > Collections and entities >

Counting the number of elements in an entity

Overview

Sometimes it is needed to count the number of elements in an entity. Bizagi offers a function that counts the elements in both master and parametric entities.

For parameter entities, this function numbers enabled records only.

 

To number the elements in an entity you can use the following function:

 

CHelper.entityListCount(EntityName, Filter)

 

The following attributes are needed:

EntityName: the entity name.

Filter: the filter condition.

 

Example

Let's suppose we need to number all the business opportunities from the Opportunities entity. The expression would be as follows:

 

Count_the_number_of_elements_01

 

var opportunities = CHelper.entityListCount("Opportunities","");

 

To number the business opportunities closed as won from a specific customer, the expression would be:

 

Count_the_number_of_elements_02

 

var opportunities = CHelper.entityListCount("Opportunities","Customer = '352' AND Status ='won'");