Macros and Workflow Modularity
What to know
Macros package logic for reuse. Know the three types: Standard (a workflow wrapped as a tool with input/output anchors), Batch (runs a Standard macro over grouped records via a Control Parameter), and Iterative (loops until a condition is met, with an iteration output). Understand macro inputs: Macro Input (defines the anchor and incoming fields), Macro Output, Control Parameter (drives batch grouping), and the Interface tools (Text Box, Drop Down, Action, Condition) used to build apps. Know how to save and insert a macro, and that macros must be saved before they can be inserted.
Traps
- Control Parameter only in Batch: Iterative macros don't use a Control Parameter the same way; they loop on a condition.
- Interface tools belong to the parent: In a Standard macro, interface tools configure the macro's inputs; an Action tool connects an interface element to a tool's configuration.
- Anchor mapping: Macro Input/Output anchors must match the workflow's expectations; mismatched field schemas break downstream tools.
- Batch grouping: The field connected to the Control Parameter defines the batches-one run per unique value.
- Saving: A macro must be saved as a .yxmc before insertion; unsaved changes aren't reflected.
Rule of thumb
Ask "how many times should this run?" Once → Standard; once per group → Batch; until a condition → Iterative. The Control Parameter is the tell for Batch.
Worked example
To run a cleanup routine separately for each region, wrap the cleanup in a Standard macro, then build a Batch macro that groups by Region using a Control Parameter so the macro executes once per region value.