Skip to content
Data & Databases

Conditional Merge Bypass: Deterministic Local Append on Empty Branch

10 nodes 32 3 Manual trigger
Download

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. 1.Run the workflow manually from Run Demo
  2. 2.Emit Sample Dataset produces fictional invoice records tagged branch A or B, normalizing invalid values
  3. 3.Snapshot Branch Completeness counts items per branch and builds branchesComplete flag
  4. 4.If routes: both branches full → Merge (append, 2 inputs); otherwise → NoOp → local append Code
  5. 5.Final Unified Report normalizes output and emits exactly one report item with mode and counts
  6. 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

  1. Import the JSON into n8n and open the workflow
  2. Run Run Demo with keepBranchA=false: expect 3 branch-B items plus a local-append report documenting empty A
  3. Set keepBranchA=true and run: expect merge-append path and combined counts in the report
  4. Empty the raw array: expect exactly one report item with no error
  5. Verify final output matches expected_output

Service Value

Ready-made workflow template for automation delivery and service execution.

Apps Used

Manual Trigger Code If Merge No Op

Details

Trigger Manual trigger
Nodes 10
Apps 5
Views 32
Downloads 3

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 (10)

/

Run Demo

Manual Trigger

#1

Emit Sample Dataset

Code

#2

Snapshot Branch Completeness

Code

#3

Both Branches Ready?

If

#4

Feed Merge Input A

Code

#5

Feed Merge Input B

Code

#6

Append Merge (Both Full)

Merge

#7

Idle Path Guard

No Op

#8

Local Deterministic Append

Code

#9

Final Unified Report

Code

#10

Stage 1 - Input & Sample

Sticky Note

#11

Stage 2 - Pre-Merge Completeness Check

Sticky Note

#12

Stage 3 - Merge vs Local Append

Sticky Note

#13
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