Skip to main content

Count node

Description

A Count node counts the number of items referenced by the specified Link attribute, e.g. the Members attribute of a Teams item.

Usage

The Count node is an input, so it can be added to the segments of comparison nodes and functions.

alt text
alt text

It can be:

Configuration

alt text

The node defaults to the first Link attribute on the design/interface being queried.

  • Open in Pathfinder - use the Pathfinder to change the selected attribute.

  • Delete - remove the node from the segment.

Example

Fetch all street lights with more than 3 defects

In full detail:

Fetch items of the Street Lights design where the count of their Defects Link attribute is greater than 3

alt text
See JSON code

This code may reference designs, interfaces, attributes or items that don't exist in your Alloy database.

{
"type": "Query",
"properties": {
"collectionCode": "Live",
"dodiCode": "designs_streetLights"
},
"children": [
{
"type": "GreaterThan",
"children": [
{
"type": "Count",
"properties": {
"groupBy": "attributes_defectsAssignableDefects"
}
},
{
"type": "Number",
"properties": {
"value": [3]
}
}
]
}
]
}