Skip to content
AI Agents

Array Splitter with Parent Field Carry-Over and Count-Verified Regrouping

8 nodes 86 9 Manual trigger
Download

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. 1.Manual Trigger starts the run
  2. 2.Code node emits four fictional orders
  3. 3.Set node defines array field, id field and carry fields
  4. 4.Code splits items, carries parent context, skips non-object elements
  5. 5.IF separates parents without items
  6. 6.Code regroups and computes count_match and missing_item_indexes
  7. 7.Set marks empty parents with status=empty_parent
  8. 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

  1. Import and run manually
  2. Check ORD-1001 has count_match=true
  3. Check ORD-1004 has count_match=false and missing_item_indexes=[1]
  4. Check ORD-1002 and ORD-1003 appear as empty parents
  5. 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

Manual Trigger Code Set If Merge

Details

Trigger Manual trigger
Nodes 8
Apps 5
Views 86
Downloads 9

How to Use

  1. 1.Click "Download Template"
  2. 2.Open your n8n dashboard
  3. 3.Go to Workflows > Import from File
  4. 4.Select downloaded file and configure credentials

Nodes Used (8)

Manual Trigger

Manual Trigger

#1

Emit Sample Orders

Code

#2

Configure Split Settings

Set

#3

Split Arrays Carrying Parent Fields

Code

#4

Has Items?

If

#5

Regroup and Verify Counts

Code

#6

Mark Empty Parents

Set

#7

Combine Regrouped and Empty Parents

Merge

#8

Note Stages

Sticky Note

#9

Note Setup

Sticky Note

#10
Stay in the loop

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

Be first to discover what is new

Your name, your email, and one confirmation.

Email confirmation · Unsubscribe anytime