Back to Documentation
Tag Operations Node

Count by Query

Count entities matching a tag query and write the count to a tag for branching

Inputs

querystringrequired

Tag to match (e.g. symbol:scatter). All entities with this tag are counted.

outputEntityIdstring

Entity to write the count tag on

Default: global

outputTagstringrequired

Tag prefix for the count (e.g. round:scatterCount → writes round:scatterCount:N)

Outputs

countnumber

Number of entities matching the query

Overview

Runs a tag query (same as TagQuery), counts the matching entities, and writes the count to a tag on the specified entity. The written tag is outputTag:N so that Branch: Tag Compare (flow.branch.tagCompare) can branch on it (e.g. scatterCount ≥ 3).

Typical flow

  1. Count by Query: query symbol:scatter, outputTag round:scatterCount
  2. Branch: Tag Compare: pattern round:scatterCount, operator , threshold 3

Usage example

Count by Query:
  query: "symbol:scatter"
  outputEntityId: "global"
  outputTag: "round:scatterCount"
// Writes global → round:scatterCount:5 (if 5 scatters)
// Then use flow.branch.tagCompare with pattern "round:scatterCount", >= 3