Merge Item Order Preserver via Ordinal Keys with Swap Report
Loading workflow…
Workflow Description
A fully local n8n template solving item-order loss after Merge nodes. It emits fictional test data, stamps every item with a sequential ordinal key before branching, splits items via If into two Set-enrichment branches that retain all fields, merges them in append mode, then resorts by ordinal and emits an explicit swap report showing how many positions the merge changed and which item moved where. No credentials or external calls required.
How it works
- 1.Run Demo Trigger; Emit Sample Records produces six fictional records including ones with empty emails.
- 2.Assign Ordinal Keys adds a sequential ordinal to every item before any branching.
- 3.Route by Amount sends items with amount over 100 to the high-value branch, others to the standard branch.
- 4.Each Set node adds processingTier and emailStatus with includeOtherFields:true, preserving ordinal and customer fields.
- 5.Append Branches combines both branches via append mode with two independent inputs, typically breaking the order.
- 6.Resort by Ordinal and Report sorts ascending by ordinal, compares pre/post-merge positions, and emits one swap report.
Use cases
- Reports that must keep incoming row order after merging multiple processing branches
- Automatic detection of merge-induced reordering before publishing a workflow
- Customer record processing split into high-value and standard tiers with guaranteed sequence integrity
Requirements
- No credentials or external calls — the template is fully local
- To use real data: connect your real source directly to Assign Ordinal Keys with the same schema: id, customer, email, amount
Setup and testing in n8n
- Import the JSON into n8n and open the workflow
- Execute Demo Trigger and inspect Resort by Ordinal and Report: sortedCount=6 and sortedRecords matches input order
- Verify swapReport states the merge changed 5 positions with item-by-item move details
- Edge case: empty the records array in Emit Sample Records and confirm the safe no-items output
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)
Stage 1 Note
Sticky Note
Stage 2 Note
Sticky Note
Stage 3 Note
Sticky Note
Demo Trigger
Manual Trigger
Emit Sample Records
Code
Assign Ordinal Keys
Code
Route by Amount
If
Enrich High-Value Branch
Set
Enrich Standard Branch
Set
Append Branches
Merge
Resort by Ordinal and Report
Code
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