Administering : Managing business rules and expressions : Business rule definition examples : List example
  
List example
In this example, the List business rule is used to calculate the number of customer requirements that are in the “In Progress” state when a development project has reached a milestone date in the release schedule.
Consider the scenario where there are two modules: “Release” module that has all the details of a product release, and the “Requirements” module that has details of all the requirements planned for that product release.
Requirements module has a link attribute, that is linked to the Release module.
Requirements module has a view “In Progress” that lists only those requirements whose “Status” attribute shows the value “In Progress”. The ID of this view is 55.
Release module has an Incoming link attribute “Requirements”. The target of the “Requirements” attribute is the Requirements module.
To use the List business rule to find the number of requirements that are in the “In Progress” state
1 In the Release module, create an integer attribute “Number of requirements that are in progress”. This is the container attribute for the business rule.
2 Enter the following expression as the Default Value for the “Number of requirements that are in progress” attribute:
= List("no","true","55","100","-1",
"Requirements",'Requirements',"listen_to=Status")
In the above example, 55 is the view ID for the “In Progress” view of the Requirements module, 100 is the user ID, -1 indicates all the elements of the list as the business rule is meant to give a count of all the elements, Requirements is the Incoming Link attribute whose target is Requirements module, and Status is an attribute used in the view rule of the "In Progress" view.
If the Requirements module has a float attribute "Expenditure", you can use the List business rule to calculate the total expenditure for the release. To do this, create a float attribute "Release Expenditure" and enter the following expression as the Default Value for that attribute:
= List("sum","true","55","100","Expenditure","Requirements",'Requirements',"listen_to=Status","listen_to=Expenditure")
3 To validate the expression, click Evaluate Expression.
4 Make corrections, if required, and use the Number of requirements that are in progress wherever required. For example, you can use that data in the status report.
See also
List business rule
Business rule definition examples