Sequence
The Sequence node is a utility node that allows you to create a sequence of multiple output flows from a single input flow. It is useful when you need to perform a series of operations or transformations on data in a specific order.Inputs
flow(required): The input flow that will be split into a sequence of output flows.
Outputs
The Sequence node has a configurable number of outputs, determined by thenumOutputs configuration option. Each output represents a step in the sequence and will receive the flow from the previous step.
Configuration Options
numOutputs(required): An integer specifying the number of output flows to create. This determines how many steps will be in the sequence.
Usage
- Add a Sequence node to your spell.
- Connect the input flow to the Sequence node’s
flowinput. - Set the desired number of outputs using the
numOutputsconfiguration option. - Connect each output of the Sequence node to the appropriate downstream nodes representing the steps in your sequence.
- The flow will be passed through each connected output in order, allowing you to perform a series of operations.
Example
Suppose you have a spell that needs to perform the following steps on an input image:- Resize the image
- Apply a blur effect
- Convert to grayscale
- Enhance the contrast
numOutputs set to 4. The input image flows through the Sequence node, which splits it into four sequential outputs. Each output is connected to a node that performs a specific transformation (Resize, Blur, Grayscale, Contrast). The final output of the sequence is the transformed image.
Best Practices
- Use Sequence nodes to create clear, linear flows when a specific order of operations is required.
- Give each output a meaningful name that describes the step it represents.
- Keep the number of outputs reasonable to maintain readability. If your sequence is too long, consider breaking it into sub-spells.
Common Issues
- Ensure that the
numOutputsconfiguration matches the number of connected output nodes. A mismatch can lead to unexpected behavior. - Be mindful of the order in which you connect the outputs. The sequence will execute in the order the outputs are connected.
- Remember that each step in the sequence receives the output from the previous step. Ensure that the data type and format are compatible between steps.
