Docs‎ > ‎Logic Designer‎ > ‎Live Logic‎ > ‎



The Count Business Logic Rule declares a Parent attribute to be maintained as the count of a designated child role, with an optional qualification to filter child objects.  For example:

Derive orders.item_count as count(lineitemsList)

Counts are useful as chid existence checks.  For example, the item_count can be used in a (commit!) validation to ensure that orders have at least one lineitem.


 Count name  Defaulted by system, but you can override this with your own text.
 Derived attribute  The name of the parent attribute representing the count result
 Children  Defines child role being counted
 Qualification  Optional - boolean JavaScript expression designating the child rows that contribute to the count; syntax notes:
  • JavaScript means you are using logical operators such as && for "and", || for "or"
  • Equals can be specified either as "=", or "=="
 Active  Check to make rule active (requires the definition be complete)


The value of the attribute will be updated to reflect the count of the specified attribute in the child objects whenever necessary.  This includes child objects being added to and removed from the parent object, as well as modifications to the children objects that change their qualification in the Count.  Observe that count processing is triggered by changes to the child, as visible in the log.

A Count is not recalculated from scratch, but rather adjusted as necessary. For instance, when a new (qualifying) child is added to the parent, the Count attribute will be incremented by 1. This means that there is very little performance impact.

Usage Notes

To maintain high performance (per the adjustment discussion above), count values are assumed to be correct on disk.  So, if you define new counts on existing data, you need to initialize these for proper operation.

You can do that using SQL tools, like this.