AutomationFlowsDevOps › 批量数据处理循环

批量数据处理循环

批量数据处理循环. Event-driven trigger; 6 nodes.

Event trigger★★★★☆ complexity6 nodes
DevOps Trigger: Event Nodes: 6 Complexity: ★★★★☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "\u6279\u91cf\u6570\u636e\u5904\u7406\u5faa\u73af",
  "nodes": [
    {
      "parameters": {},
      "id": "trigger-node-id",
      "name": "\u5f00\u59cb\u89e6\u53d1",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "\u7528\u6237\u5217\u8868",
              "value": "[\n  {\"id\": 1, \"name\": \"\u5f20\u4e09\", \"email\": \"zhang@example.com\"},\n  {\"id\": 2, \"name\": \"\u674e\u56db\", \"email\": \"li@example.com\"},\n  {\"id\": 3, \"name\": \"\u738b\u4e94\", \"email\": \"wang@example.com\"},\n  {\"id\": 4, \"name\": \"\u8d75\u516d\", \"email\": \"zhao@example.com\"}\n]"
            }
          ]
        },
        "options": {}
      },
      "id": "data-source-id",
      "name": "\u51c6\u5907\u6570\u636e",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "// \u5c06JSON\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u6570\u7ec4\nconst userListStr = $input.first().json.\u7528\u6237\u5217\u8868;\nconst userList = JSON.parse(userListStr);\n\n// \u4e3a\u6bcf\u4e2a\u7528\u6237\u521b\u5efa\u4e00\u4e2a\u6570\u636e\u9879\nreturn userList.map(user => ({\n  json: {\n    id: user.id,\n    name: user.name,\n    email: user.email,\n    status: '\u5f85\u5904\u7406'\n  }\n}));"
      },
      "id": "convert-data-id",
      "name": "\u8f6c\u6362\u6570\u636e\u683c\u5f0f",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        680,
        300
      ]
    },
    {
      "parameters": {
        "batchSize": 2,
        "options": {}
      },
      "id": "split-batch-id",
      "name": "\u5206\u6279\u5904\u7406",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        900,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "// \u6a21\u62df\u5904\u7406\u6bcf\u4e2a\u7528\u6237\u7684\u903b\u8f91\nconst items = $input.all();\n\nreturn items.map(item => {\n  const user = item.json;\n  \n  // \u6a21\u62df\u4e00\u4e9b\u5904\u7406\u903b\u8f91\n  const processedData = {\n    ...user,\n    status: '\u5df2\u5904\u7406',\n    processedAt: new Date().toISOString(),\n    // \u6a21\u62df\u6839\u636e\u7528\u6237ID\u8ba1\u7b97\u4e00\u4e9b\u503c\n    score: user.id * 10 + Math.floor(Math.random() * 100)\n  };\n  \n  return {\n    json: processedData\n  };\n});"
      },
      "id": "process-batch-id",
      "name": "\u5904\u7406\u5355\u6279\u6570\u636e",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1120,
        300
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "\u6279\u6b21\u4fe1\u606f",
              "value": "=\u6279\u6b21 {{ $json.batch }} \u5904\u7406\u5b8c\u6210\uff0c\u7528\u6237\uff1a{{ $json.name }}"
            }
          ]
        },
        "options": {}
      },
      "id": "log-batch-id",
      "name": "\u8bb0\u5f55\u5904\u7406\u65e5\u5fd7",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3,
      "position": [
        1340,
        300
      ]
    }
  ],
  "connections": {
    "\u5f00\u59cb\u89e6\u53d1": {
      "main": [
        [
          {
            "node": "\u51c6\u5907\u6570\u636e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u51c6\u5907\u6570\u636e": {
      "main": [
        [
          {
            "node": "\u8f6c\u6362\u6570\u636e\u683c\u5f0f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u8f6c\u6362\u6570\u636e\u683c\u5f0f": {
      "main": [
        [
          {
            "node": "\u5206\u6279\u5904\u7406",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u5206\u6279\u5904\u7406": {
      "main": [
        [
          {
            "node": "\u5904\u7406\u5355\u6279\u6570\u636e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u5904\u7406\u5355\u6279\u6570\u636e": {
      "main": [
        [
          {
            "node": "\u8bb0\u5f55\u5904\u7406\u65e5\u5fd7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u8bb0\u5f55\u5904\u7406\u65e5\u5fd7": {
      "main": [
        [
          {
            "node": "\u5206\u6279\u5904\u7406",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "createdAt": "2024-12-17T10:15:00.000Z",
  "updatedAt": "2024-12-17T10:15:00.000Z",
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "meta": {
    "description": "\u6f14\u793a\u5982\u4f55\u4f7f\u7528Split in Batches\u8282\u70b9\u8fdb\u884c\u6279\u91cf\u6570\u636e\u5904\u7406\u7684\u5faa\u73af\u64cd\u4f5c"
  },
  "versionId": "loop-example-version-1"
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

批量数据处理循环. Event-driven trigger; 6 nodes.

Source: https://github.com/lengzhao/lengzhao.github.io/blob/64b5ebed8d3117e82111fb61b33e830eb9c23003/examples/n8n-loop-example.json — original creator credit. Request a take-down →

More DevOps workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

DevOps

This template lets you selectively import n8n workflows from a GitHub repository, even when your repository uses deeply nested folder structures.

Form Trigger, GitHub, n8n +1
DevOps

Code Github. Uses manualTrigger, stickyNote, n8n, httpRequest. Event-driven trigger; 25 nodes.

n8n, HTTP Request, GitHub +1
DevOps

Code Github. Uses manualTrigger, stickyNote, httpRequest, noOp. Event-driven trigger; 24 nodes.

HTTP Request, GitHub, Execute Command +1
DevOps

Triggers manually or on schedule (03:00 daily by default) Fetches workflows tagged via n8n API Normalizes workflow names and applies tag convention Prepares JSON in the same structure as an n8n UI exp

n8n, GitLab
DevOps

Code Github. Uses manualTrigger, stickyNote, n8n, httpRequest. Event-driven trigger; 23 nodes.

n8n, HTTP Request, GitHub +1