Working with Loops and Selectors
Learn how loop nodes iterate over entity collections or property arrays, how selector nodes pick specific items, and how context propagates through the flow.
Loops and selectors are the two main ways to navigate collections in a document projection flow. Loops produce output for every item in a collection, while selectors extract a single item for focused output.
Loop Nodes
A loop node takes a collection from its incoming context and iterates over each item. Every node connected downstream from the loop runs once per item in the collection.
Configuring a Loop
What You Can Loop Over
| Collection Type | Example | Result |
|---|---|---|
| Entity collection | All entities in the model | One iteration per entity |
| Property array | Properties of a single entity | One iteration per property |
| Nested collection | Foreign key references on an entity | One iteration per reference |
Selector Nodes
A selector node picks one specific item from a collection rather than iterating over all of them. This is useful when you need to generate content for a particular entity or property by name or index.
Configuring a Selector
Context Propagation
One of the most important concepts in document projections is context propagation. As data flows through the graph, each node accumulates scope from its ancestors.
Nested Loops
You can nest loops to traverse hierarchical data. For example, an outer loop iterates over entities while an inner loop iterates over each entity's properties. Inside the inner loop, the context includes both the current entity (from the outer loop) and the current property (from the inner loop). This lets you reference parent scope fields in your output - such as including the entity name in a property table.
Practical Example
Consider a flow that generates a data dictionary page for each entity: