データ同期を学ぶ:在庫監査チュートリアル

上級

これはEngineering分野の自動化ワークフローで、17個のノードを含みます。主にSet, SplitOut, ManualTrigger, CompareDatasetsなどのノードを使用。 データ同期を学ぶ:在庫監査チュートリアル

前提条件
  • 特別な前提条件なし、インポートしてすぐに使用可能
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "meta": {
    "instanceId": "e409ea34548a2afe2dffba31130cd1cf2e98ebe2afaeed2a63caf2a0582d1da0"
  },
  "nodes": [
    {
      "id": "6164f1ea-1e44-4f94-8c69-c064b477c53d",
      "name": "監査開始",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -544,
        2768
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d6038f48-07a8-40b2-b4c5-00985932ec81",
      "name": "付箋1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        2336
      ],
      "parameters": {
        "color": 5,
        "width": 400,
        "height": 680,
        "content": "### The Auditor's Report\n\nThis is the **Compare Datasets** node, our Auditor.\n\n**How it works:**\n1.  **Fields to Match:** It uses the `product_id` as a unique \"barcode\" to identify the same item in both warehouses.\n2.  **Source of Truth:** We've told it that if an item is **different**, it should **Use Input A Version**. This means Warehouse A's data is always correct.\n\n\n**The Four Outputs:**\nThe Auditor produces a report with four categories, which correspond to the four outputs of this node."
      },
      "typeVersion": 1
    },
    {
      "id": "d191a3b6-13e5-460e-a5a8-87d0c50fe31b",
      "name": "付箋2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        512,
        2368
      ],
      "parameters": {
        "color": 6,
        "width": 384,
        "height": 400,
        "content": "### ✅ All Good (Do Nothing)\n\n**What this means:** The Auditor found that this item (the 'Keyboard') is exactly the same in both Warehouse A and Warehouse B.\n\n**Action:** No action is needed! The data is already in sync."
      },
      "typeVersion": 1
    },
    {
      "id": "b03f0d8c-7177-4069-8869-347e079c42bf",
      "name": "➕ Warehouse Bに追加",
      "type": "n8n-nodes-base.noOp",
      "position": [
        640,
        2192
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "dbfb3df3-e494-411c-975c-14edccaa7a8e",
      "name": "Warehouse A (情報源)",
      "type": "n8n-nodes-base.set",
      "position": [
        -288,
        2608
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "12345",
              "name": "products",
              "type": "array",
              "value": "=[\n   {\n      \"product_id\":\"P-001\",\n      \"name\":\"Keyboard\",\n      \"stock\":200\n   },\n   {\n      \"product_id\":\"P-002\",\n      \"name\":\"Mouse\",\n      \"stock\":150\n   },\n   {\n      \"product_id\":\"P-003\",\n      \"name\":\"Webcam\",\n      \"stock\":75\n   }\n]"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "70322c6f-5892-4259-b4ff-97449bd94c39",
      "name": "✅ 問題なし (対応不要)",
      "type": "n8n-nodes-base.noOp",
      "position": [
        640,
        2592
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "8f1f09a5-cf83-4ec4-90f5-85fd30bff3d6",
      "name": "🔄 Warehouse Bで更新",
      "type": "n8n-nodes-base.noOp",
      "position": [
        640,
        3024
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "1572db04-7da7-4d64-835b-a98aca3ef4bc",
      "name": "❌ Warehouse Bから削除",
      "type": "n8n-nodes-base.noOp",
      "position": [
        640,
        3424
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "a8f72c77-c484-46bf-a08d-05973c99b93d",
      "name": "監査担当者",
      "type": "n8n-nodes-base.compareDatasets",
      "position": [
        224,
        2768
      ],
      "parameters": {
        "options": {},
        "mergeByFields": {
          "values": [
            {
              "field1": "product_id",
              "field2": "product_id"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "83decaff-9f4a-4729-ac52-6ce9b4e31be9",
      "name": "Warehouse B (同期対象)",
      "type": "n8n-nodes-base.set",
      "position": [
        -288,
        2928
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "27aceae0-8a0b-4fcf-b8a6-fc1f16cc4863",
              "name": "products",
              "type": "array",
              "value": "=[\n   {\n      \"product_id\":\"P-001\",\n      \"name\":\"Keyboard\",\n      \"stock\":200\n   },\n   {\n      \"product_id\":\"P-002\",\n      \"name\":\"Mouse\",\n      \"stock\":100\n   },\n   {\n      \"product_id\":\"P-004\",\n      \"name\":\"Monitor\",\n      \"stock\":50\n   }\n]"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "eb5dbdfb-6780-44ad-b019-a2c0d2b53430",
      "name": "付箋9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1040,
        2336
      ],
      "parameters": {
        "width": 688,
        "height": 612,
        "content": "### Tutorial: The Data Auditor (Compare Datasets)\n\nWelcome! This workflow will teach you how to use one of the most powerful nodes for data synchronization: **Compare Datasets**.\n\n**The Analogy: Auditing Two Warehouses**\n- **Warehouse A:** Our main, \"source of truth\" warehouse. This is the master list of what we *should* have.\n- **Warehouse B:** A second, remote warehouse. We need to make sure its inventory matches Warehouse A.\n- **The Compare Datasets Node:** This is the **Auditor** with a clipboard, checking both lists to find differences.\n\n\n**How to use this tutorial:**\n1.  Click **\"Execute Workflow\"**.\n2.  Click on each of the four output nodes (`NoOp` nodes) to see which items ended up where.\n3.  Read the sticky notes to understand why each item was sorted into its specific branch."
      },
      "typeVersion": 1
    },
    {
      "id": "9b721fda-52d3-4de5-bdde-a58919456135",
      "name": "付箋11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        512,
        1952
      ],
      "parameters": {
        "color": 6,
        "width": 384,
        "height": 400,
        "content": "### ➕ Add to Warehouse B\n\n**What this means:** The Auditor found this item (the 'Webcam') in our main Warehouse A, but it's **missing** from Warehouse B.\n\n**Action:** The next step in a real workflow would be to take this item and **create** it in Warehouse B (e.g., add a new row to a Google Sheet or a new item in Notion)."
      },
      "typeVersion": 1
    },
    {
      "id": "b1dadc19-0dc4-4709-9bc6-9b5a7431db2a",
      "name": "付箋12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        512,
        2784
      ],
      "parameters": {
        "color": 6,
        "width": 384,
        "height": 400,
        "content": "### 🔄 Update in Warehouse B\n\n**What this means:** The Auditor found this item (the 'Mouse') in both warehouses, but its details are **different**. (Warehouse A has 150 in stock, but B only has 100).\n\n**Action:** The next step would be to **update** the existing item in Warehouse B with the correct data from Warehouse A."
      },
      "typeVersion": 1
    },
    {
      "id": "87ad324e-c596-4968-b484-8d778dacba0b",
      "name": "付箋13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        512,
        3200
      ],
      "parameters": {
        "color": 6,
        "width": 384,
        "height": 400,
        "content": "### ❌ Remove from Warehouse B\n\n**What this means:** The Auditor found this item (the 'Monitor') in Warehouse B, but it **does not exist** in our main Warehouse A.\n\n**Action:** The next step would be to **delete** this item from Warehouse B, as it's an extra item that shouldn't be there."
      },
      "typeVersion": 1
    },
    {
      "id": "19538cc0-b536-49c1-9874-af8d237ca71c",
      "name": "付箋14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        928,
        2384
      ],
      "parameters": {
        "color": 3,
        "width": 540,
        "height": 784,
        "content": "## Was this helpful? Let me know!\n\nI really hope this template helped you understand how the Compare Datasets node works. Your feedback is incredibly valuable and helps me create better resources for the n8n community.\n\n### **Share Your Thoughts & Ideas**\n\nWhether you have a suggestion, found a typo, or just want to say thanks, I'd love to hear from you!\nHere's a simple n8n form built for this purpose:\n\n#### ➡️ **[Click here to give feedback](https://api.ia2s.app/form/templates/feedback?template=Compare%20Datasets)**\n\n### **Ready to Build Something Great?**\n\nIf you're looking to take your n8n skills or business automation to the next level, I can help.\n\n**🎓 n8n Coaching:** Want to become an n8n pro? I offer one-on-one coaching sessions to help you master workflows, tackle specific problems, and build with confidence.\n#### ➡️ **[Book a Coaching Session](https://api.ia2s.app/form/templates/coaching?template=Compare%20Datasets)**\n\n**💼 n8n Consulting:** Have a complex project, an integration challenge, or need a custom workflow built for your business? Let's work together to create a powerful automation solution.\n#### ➡️ **[Inquire About Consulting Services](https://api.ia2s.app/form/templates/consulting?template=Compare%20Datasets)**\n\n---\n\nHappy Automating!\nLucas Peyrin"
      },
      "typeVersion": 1
    },
    {
      "id": "a6fca263-dd05-408f-9556-498985daca96",
      "name": "製品を振り分け (B)",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -64,
        2928
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "products"
      },
      "typeVersion": 1
    },
    {
      "id": "9114df4e-e8d6-47d3-811d-dcd416ff667a",
      "name": "製品を振り分け (A)",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -64,
        2608
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "products"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "6164f1ea-1e44-4f94-8c69-c064b477c53d": {
      "main": [
        [
          {
            "node": "dbfb3df3-e494-411c-975c-14edccaa7a8e",
            "type": "main",
            "index": 0
          },
          {
            "node": "83decaff-9f4a-4729-ac52-6ce9b4e31be9",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a8f72c77-c484-46bf-a08d-05973c99b93d": {
      "main": [
        [
          {
            "node": "b03f0d8c-7177-4069-8869-347e079c42bf",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "70322c6f-5892-4259-b4ff-97449bd94c39",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "8f1f09a5-cf83-4ec4-90f5-85fd30bff3d6",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "1572db04-7da7-4d64-835b-a98aca3ef4bc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9114df4e-e8d6-47d3-811d-dcd416ff667a": {
      "main": [
        [
          {
            "node": "a8f72c77-c484-46bf-a08d-05973c99b93d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a6fca263-dd05-408f-9556-498985daca96": {
      "main": [
        [
          {
            "node": "a8f72c77-c484-46bf-a08d-05973c99b93d",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "83decaff-9f4a-4729-ac52-6ce9b4e31be9": {
      "main": [
        [
          {
            "node": "a6fca263-dd05-408f-9556-498985daca96",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "dbfb3df3-e494-411c-975c-14edccaa7a8e": {
      "main": [
        [
          {
            "node": "9114df4e-e8d6-47d3-811d-dcd416ff667a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

上級 - エンジニアリング

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

関連ワークフロー

ワークフロー情報
難易度
上級
ノード数17
カテゴリー1
ノードタイプ6
難易度説明

上級者向け、16ノード以上の複雑なワークフロー

作成者
Lucas Peyrin

Lucas Peyrin

@lucaspeyrin

Innovative builder with a passion for crafting automation solutions that solve real-world challenges. From streamlining workflows to driving efficiency, my work empowers teams and individuals to achieve more with less effort. Experienced in developing scalable tools and strategies that deliver results with n8n, supabase and cline.

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34