{ "nodes": [ { "id": "merge-ingredient-and-band-lists-0", "name": "On clicking 'execute'", "type": "n8n-nodes-base.manualTrigger", "position": [ 1040, 360 ], "parameters": {}, "typeVersion": 1 }, { "id": "merge-ingredient-and-band-lists-1", "name": "Note", "type": "n8n-nodes-base.stickyNote", "position": [ 1320, 600 ], "parameters": { "width": 1020, "height": 360, "content": "# 3. Add items from B below items from A\n" }, "typeVersion": 1 }, { "id": "merge-ingredient-and-band-lists-2", "name": "Note1", "type": "n8n-nodes-base.stickyNote", "position": [ 1320, -200 ], "parameters": { "width": 1020, "height": 380, "content": "# 1. Keep items from A if there's a match in B\n" }, "typeVersion": 1 }, { "id": "merge-ingredient-and-band-lists-3", "name": "Note2", "type": "n8n-nodes-base.stickyNote", "position": [ 1320, 200 ], "parameters": { "width": 1020, "height": 380, "content": "# 2. Enrich items from A with matching data from B" }, "typeVersion": 1 }, { "id": "merge-ingredient-and-band-lists-4", "name": "Note4", "type": "n8n-nodes-base.stickyNote", "position": [ 175, 235 ], "parameters": { "width": 740, "height": 460, "content": "# Aggregating data with the Merge node\n\n## The merge node is one of the most useful nodes in n8n. In this workflow we show how to merge data from two different sources (similar to SQL joins).\n\n## The most-used operations of the merge node are presented here. For more info, browse the [merge node docs](https://docs.n8n.io/integrations/core-nodes/n8n-nodes-base.merge/)\n\n## Click the `Execute Workflow` button and double click on the nodes to see the input and output items." }, "typeVersion": 1 }, { "id": "merge-ingredient-and-band-lists-5", "name": "Note6", "type": "n8n-nodes-base.stickyNote", "position": [ 1855, 335 ], "parameters": { "width": 480, "content": "## Adds the quantity needed to each ingredient in the recipe\n\n## Similar to SQL Left join\n\n" }, "typeVersion": 1 }, { "id": "merge-ingredient-and-band-lists-6", "name": "Note8", "type": "n8n-nodes-base.stickyNote", "position": [ 1855, -65 ], "parameters": { "width": 480, "content": "## This will keep only the ingredients needed that are also in stock\n\n## Similar to SQL Inner join" }, "typeVersion": 1 }, { "id": "merge-ingredient-and-band-lists-7", "name": "Note9", "type": "n8n-nodes-base.stickyNote", "position": [ 1855, 695 ], "parameters": { "width": 480, "height": 200, "content": "## This will create a super band by merging Queen and Led Zeppelin\n\n## Similar to SQL Union All \n(more flexible as not requires all fields to be the same)" }, "typeVersion": 1 }, { "id": "merge-ingredient-and-band-lists-8", "name": "Ingredients in stock from recipe", "type": "n8n-nodes-base.merge", "position": [ 1600, -20 ], "parameters": { "mode": "combine", "options": {}, "mergeByFields": { "values": [ { "field1": "Name", "field2": "Name" } ] } }, "typeVersion": 2 }, { "id": "merge-ingredient-and-band-lists-9", "name": "Super Band", "type": "n8n-nodes-base.merge", "position": [ 1620, 760 ], "parameters": {}, "typeVersion": 2 }, { "id": "merge-ingredient-and-band-lists-10", "name": "A. Ingredients Needed", "type": "n8n-nodes-base.code", "position": [ 1360, -100 ], "parameters": { "jsCode": " return [\n {\n \"Name\": \"Flour\",\n },\n {\n \"Name\": \"Eggs\",\n },\n {\n \"Name\": \"Milk\",\n },\n {\n \"Name\": \"Lemon\",\n },\n {\n \"Name\": \"Sugar\",\n },\n];\n" }, "typeVersion": 1 }, { "id": "merge-ingredient-and-band-lists-11", "name": "B. Ingredients in stock", "type": "n8n-nodes-base.code", "position": [ 1360, 40 ], "parameters": { "jsCode": " return [\n {\n \"Name\": \"Eggs\",\n },\n {\n \"Name\": \"Lemon\",\n },\n {\n \"Name\": \"Sugar\",\n },\n];\n" }, "typeVersion": 1 }, { "id": "merge-ingredient-and-band-lists-12", "name": "Merge recipe", "type": "n8n-nodes-base.merge", "position": [ 1620, 380 ], "parameters": { "mode": "combine", "options": {}, "joinMode": "enrichInput1", "mergeByFields": { "values": [ { "field1": "Name", "field2": "Name" } ] } }, "typeVersion": 2 }, { "id": "merge-ingredient-and-band-lists-13", "name": "A. Ingredients", "type": "n8n-nodes-base.code", "position": [ 1360, 300 ], "parameters": { "jsCode": " return [\n {\n \"Name\": \"Flour\",\n },\n {\n \"Name\": \"Eggs\",\n },\n {\n \"Name\": \"Milk\",\n },\n {\n \"Name\": \"Lemon\",\n },\n {\n \"Name\": \"Sugar\",\n },\n];\n" }, "typeVersion": 1 }, { "id": "merge-ingredient-and-band-lists-14", "name": "B. Recipe quantities", "type": "n8n-nodes-base.code", "position": [ 1360, 440 ], "parameters": { "jsCode": " return [\n {\n \"Name\": \"Flour\",\n \"Quantity\": \"100g\",\n },\n {\n \"Name\": \"Eggs\",\n \"Quantity\": 2,\n },\n {\n \"Name\": \"Salt\",\n \"Quantity\": \"50g\"\n },\n {\n \"Name\": \"Lemon\",\n \"Quantity\": 1,\n },\n {\n \"Name\": \"Sugar\",\n \"Quantity\": \"6tbsp\",\n },\n];\n" }, "typeVersion": 1 }, { "id": "merge-ingredient-and-band-lists-15", "name": "A. Queen", "type": "n8n-nodes-base.code", "position": [ 1360, 680 ], "parameters": { "jsCode": " return [\n{\n\"FirstName\": \"John\",\n\"LastName\": \"Deacon\",\n\"Instrument\": \"Drums\",\n},\n{\n\"FirstName\": \"Freddy\",\n\"LastName\": \"Mercury\",\n\"Instrument\": \"Vocals and Piano\",\n\"Superpower\": \"Crowd control\"\n},\n{\n\"FirstName\": \"Brian\",\n\"LastName\": \"May\",\n\"Instrument\": \"Guitar\",\n},\n{\n\"FirstName\": \"Roger\",\n\"LastName\": \"Taylor\",\n\"Instrument\": \"Bass\",\n}\n];\n" }, "typeVersion": 1 }, { "id": "merge-ingredient-and-band-lists-16", "name": "B. Led Zeppelin", "type": "n8n-nodes-base.code", "position": [ 1360, 820 ], "parameters": { "jsCode": " return [\n{\n\"FirstName\": \"Jimmy\",\n\"LastName\": \"Page\",\n\"Instrument\": \"Guitar\"\n},\n{\n\"FirstName\": \"Robert\",\n\"LastName\": \"Plant\",\n\"Instrument\": \"Vocals\",\n},\n{\n\"FirstName\": \"John\",\n\"LastName\": \"Bonham\",\n\"Instrument\": \"Drums\",\n},\n{\n\"FirstName\": \"John\",\n\"LastName\": \"Paul Jones\",\n\"Instrument\": \"Bass\",\n\"Second Instrument\": \"Keyboard\",\n}\n];\n" }, "typeVersion": 1 } ], "connections": { "A. Queen": { "main": [ [ { "node": "Super Band", "type": "main", "index": 0 } ] ] }, "A. Ingredients": { "main": [ [ { "node": "Merge recipe", "type": "main", "index": 0 } ] ] }, "B. Led Zeppelin": { "main": [ [ { "node": "Super Band", "type": "main", "index": 1 } ] ] }, "B. Recipe quantities": { "main": [ [ { "node": "Merge recipe", "type": "main", "index": 1 } ] ] }, "A. Ingredients Needed": { "main": [ [ { "node": "Ingredients in stock from recipe", "type": "main", "index": 0 } ] ] }, "On clicking 'execute'": { "main": [ [ { "node": "A. Ingredients Needed", "type": "main", "index": 0 }, { "node": "B. Ingredients in stock", "type": "main", "index": 0 }, { "node": "A. Ingredients", "type": "main", "index": 0 }, { "node": "B. Recipe quantities", "type": "main", "index": 0 }, { "node": "A. Queen", "type": "main", "index": 0 }, { "node": "B. Led Zeppelin", "type": "main", "index": 0 } ] ] }, "B. Ingredients in stock": { "main": [ [ { "node": "Ingredients in stock from recipe", "type": "main", "index": 1 } ] ] } }, "name": "Merge Ingredient and Band Lists", "active": false, "pinData": {} }