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.
It can be:
-
added to these comparison nodes:
- Equals
- Greater than
- Less than
- Not Equals
-
compared against these nodes:
- Attribute (of Number type)
- Count
- Length
- Value From Item Attribute (of Number type)
- all Arithmetic nodes
Configuration
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
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]
}
}
]
}
]
}