MOP 多路分支
AI-generatedSummary
Read a specified JSON field from each input item and compare its value against a list of defined match strings (one per line, each representing a branch lane). Assign a lane index to each item based on the first matching line; if none match, assign a default lane index.
Inputs
- branchField (required) — Dot notation path to the field in each item's JSON to read and compare for routing.
- routeMatchers (required) — Multiline string where each line defines a value corresponding to a branch lane index (0-based). Comparison proceeds top-down and stops at the first match.
- caseSensitive — Boolean flag to control if the field value comparison is case sensitive; defaults to false.
- defaultLaneIndex — The fallback branch lane index (0-based) used if no match occurs; must be less than the number of lanes defined.
Output shape
a single output containing all input items, each augmented with a 'mopBranch' JSON property describing the branching result including 'lane' index.
Output items copy original JSON with an added 'mopBranch' object containing: branchField path, raw field value, resolved lane index, total lane count, matched index and value if any, default lane index, a sourceHandle string (
br-<lane>), and a boolean 'isDefaultMatch' indicating if the default lane was used due to no match. Maximum 32 lanes supported. Output is a single main output array of all processed items.
Examples
Example 1: Route items by their 'branchKey' field matching lines 'a', 'b', or 'c', ignoring case.
branchField set to 'branchKey'; routeMatchers set to lines 'a\nb\nc'; caseSensitive false; defaultLaneIndex 0.