Conditional Merge Bypass: Deterministic Local Append on Empty Branch
Loading workflow…
Workflow Description
A self-contained n8n template that solves Merge-node hangs when an If branch is empty. A manual trigger feeds fictional branch-tagged data (A/B), a Code node snapshots per-branch item counts and builds a completeness flag, then an If node routes the complete case to a 2-input append Merge and the deficient case to a deterministic local append inside Code with a report naming the empty branch and counts. A final Code node returns one unified report per execution.
How it works
- 1.Run the workflow manually from Run Demo
- 2.Emit Sample Dataset produces fictional invoice records tagged branch A or B, normalizing invalid values
- 3.Snapshot Branch Completeness counts items per branch and builds branchesComplete flag
- 4.If routes: both branches full → Merge (append, 2 inputs); otherwise → NoOp → local append Code
- 5.Final Unified Report normalizes output and emits exactly one report item with mode and counts
- 6.To test: set keepBranchA=true for the Merge path, or empty the array for both-empty case
Use cases
- Multi-branch n8n flows ending in a Merge node where conditional nodes can empty a branch
- Documenting which branch was empty and how many items each branch contributed
- Guaranteeing deterministic output without waiting or 'No Merge Data Found' errors
Requirements
- n8n 2.46.6 with manualTrigger, Code, If, Merge (append mode, numberInputs=2), NoOp and StickyNote nodes
- No credentials needed: fully self-contained with fictional data
- To use real data, replace the raw array in Emit Sample Dataset with items of the same schema
Setup and testing in n8n
- Import the JSON into n8n and open the workflow
- Run Run Demo with keepBranchA=false: expect 3 branch-B items plus a local-append report documenting empty A
- Set keepBranchA=true and run: expect merge-append path and combined counts in the report
- Empty the raw array: expect exactly one report item with no error
- Verify final output matches expected_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 (10)
Run Demo
Manual Trigger
Emit Sample Dataset
Code
Snapshot Branch Completeness
Code
Both Branches Ready?
If
Feed Merge Input A
Code
Feed Merge Input B
Code
Append Merge (Both Full)
Merge
Idle Path Guard
No Op
Local Deterministic Append
Code
Final Unified Report
Code
Stage 1 - Input & Sample
Sticky Note
Stage 2 - Pre-Merge Completeness Check
Sticky Note
Stage 3 - Merge vs Local Append
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