Array Splitter with Parent Field Carry-Over and Count-Verified Regrouping
Loading workflow…
Workflow Description
Splits each parent record's item array into standalone items carrying parent_id, item_index and selected parent fields. Parents with empty or missing arrays are routed to a separate path instead of disappearing. Items are then regrouped by parent_id in original order, and the regrouped count is compared to the original array length, producing count_match and listing missing item indexes (e.g. invalid non-object elements). Runs fully locally on fictional sample data.
How it works
- 1.Manual Trigger starts the run
- 2.Code node emits four fictional orders
- 3.Set node defines array field, id field and carry fields
- 4.Code splits items, carries parent context, skips non-object elements
- 5.IF separates parents without items
- 6.Code regroups and computes count_match and missing_item_indexes
- 7.Set marks empty parents with status=empty_parent
- 8.Merge appends both paths
Use cases
- Process order lines individually then rebuild orders
- Detect silently lost invoice lines
Requirements
- No credentials required
- Edit the Set node to match your field names
Setup and testing in n8n
- Import and run manually
- Check ORD-1001 has count_match=true
- Check ORD-1004 has count_match=false and missing_item_indexes=[1]
- Check ORD-1002 and ORD-1003 appear as empty parents
- Replace sample node with a real source of the same schema
Service Value
Ready-made workflow template for automation delivery and service execution.
Apps Used
Details
How to Use
- 1.Click "Download Template"
- 2.Open your n8n dashboard
- 3.Go to Workflows > Import from File
- 4.Select downloaded file and configure credentials
Nodes Used (8)
Manual Trigger
Manual Trigger
Emit Sample Orders
Code
Configure Split Settings
Set
Split Arrays Carrying Parent Fields
Code
Has Items?
If
Regroup and Verify Counts
Code
Mark Empty Parents
Set
Combine Regrouped and Empty Parents
Merge
Note Stages
Sticky Note
Note Setup
Sticky Note
Fresh workflows, straight to your inbox
Get newly published DROPIDEA workflows, a clear overview of what they do, and a link to explore them.
- New workflows
- Clear overviews
- Setup guides