Administering : Managing business rules and expressions : Business rules definitions : List business rule
  
List business rule
The List business rule is used to perform mathematical functions such as sum, average, minimum, and maximum on a Date, Float or Integer attribute for the elements in a Link List or an Incoming Links attribute. The business rule can also be used to calculate the number of links.The result of the mathematical function is displayed in a business rule container attribute. When the values of the elements change, the results are automatically recalculated.
Do not use this business rule for Incoming Link attributes that only display links from views.
To use the List business rule on an incoming link attribute
1 Configure the incoming link attribute to target a module. The Incoming List attribute has the complete list of links from the target module to the current element.
2 Define a view in the target module. Ensure that the List business rule is configured to target the module, and not to target the view in the module.
3 Provide the “User ID” and “View ID” (of the view in the target module) in the business rule.
4 Include all of the attributes mentioned in the view rule as “listen_to” attributes in the business rule.
When the “View ID” of target module is passed to the business rule, the List business rule process only those elements in the incoming list, that satisfies the view rule.
Prerequisites
In the source module, a Float or Integer attribute that contains the value to be used for the calculation.
In the target module, a Link List, or Incoming Links attribute that lists the elements from which the values are gathered.
In the target module, a business rule container attribute in which the result of the mathematical function is displayed. The business rule container attribute can be of type Date, Float, or Integer.
Format
In the business rule container attribute, enter the business rule in the following format:
= List("Function","Safe","View ID","User ID",
"Attribute Name","List Attribute Name",'List Attribute Name',
"listen_to=Source Attribute Name",
"listen_to=View Rule Attribute Name")
Example
= List("min", "true", "420", "35",
"ValueAttribute","ListAttribute",'ListAttribute')
Parameters
 
Parameter
Description
"Function"
The mathematical function to be performed. Use min to calculate minimum, max to calculate maximum, sum to calculate sum, avg to calculate average, and no to calculate the number of links. sum function is not applicable for Date attributes.
"Safe"
Set this parameter to true if the business rule should fail for non-numeric values.
"View ID"
The ID of the view that determines the elements to be included in the calculation. Use -1 to include all the elements.
"User ID"
The global user ID of the member who has access to the view mentioned for the List business rule. If View ID is ‑1, specify User ID also as -1.
"Attribute Name"
The name of the attribute in the linked element that is to be used. You can provide a space instead of providing a specific attribute name.
Example:
= List ("No", "false", "-1", "-1",
" ","ListAttribute", 'ListAttribute')
"List Attribute Name"
The name of the Link List or an Incoming Links attribute.
'List Attribute Name'
The name of the Link List or an Incoming Links attribute.
"listen_to"
Detects changes in a specified attribute in the linked elements. A listen_to parameter must be specified for the source attribute. Additional listen_to parameters are needed for each attribute in the source module that the view rules depend on.
Example: Consider a view that has two elements, ElementA and ElementB, each with a Status and Time attribute. If the view rule is “All elements whose Status is Accepted”, the business rule must have two listen_to parameters, one each for the Status attribute and the Time attribute, that the view rule depends on. The business rule can be:
= List("sum","true","55","100","Time",
"Elements",'Elements',"listen_to=Status",
"listen_to=Time")
This ensures that the result of the business rule is updated when either the time attribute or the status attribute change.
See also
List example
LinkListAttributeSum business rule
Managing business rules and expressions