{
  "id": "e7DP1CFJj6GCwLWN",
  "createdAt": "2023-07-13T03:35:14.598Z",
  "updatedAt": "2023-07-13T06:26:10.368Z",
  "name": "[Gus] Loans to GSheet main",
  "active": false,
  "nodes": [
    {
      "id": "42ec67fc-62e1-494f-9290-4b55529666cc",
      "name": "clear sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -300,
        -320
      ],
      "parameters": {
        "operation": "clear",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 676534839,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ujRe-V0vEA_fF-ZzUZx5IQ_Wn7bthqwINEB54QdKilM/edit#gid=676534839",
          "cachedResultName": "investments"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1ujRe-V0vEA_fF-ZzUZx5IQ_Wn7bthqwINEB54QdKilM",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ujRe-V0vEA_fF-ZzUZx5IQ_Wn7bthqwINEB54QdKilM/edit?usp=drivesdk",
          "cachedResultName": "test_loans_admin_cl"
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 3
    },
    {
      "id": "d6535b12-fa72-4d9b-9817-7f4cd7cedb2d",
      "name": "Set1",
      "type": "n8n-nodes-base.set",
      "position": [
        500,
        -320
      ],
      "parameters": {
        "values": {
          "number": [
            {
              "name": "start",
              "value": "={{ ($runIndex+1)*10000 }}"
            }
          ]
        },
        "options": {}
      },
      "executeOnce": true,
      "typeVersion": 2
    },
    {
      "id": "5aa94e40-9b7a-4ec1-b2f5-ea339a1db64a",
      "name": "Execute Workflow",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        220,
        -320
      ],
      "parameters": {
        "workflowId": "8"
      },
      "typeVersion": 1
    },
    {
      "id": "5053c80e-d1f7-42b0-b4d5-3b9fefc20bd4",
      "name": "When clicking \"Execute Workflow\"",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -760,
        -320
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c4f42dc4-3151-4af3-b12e-27ddedf7570a",
      "name": "IF",
      "type": "n8n-nodes-base.if",
      "position": [
        720,
        -320
      ],
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{ $json.start }}",
              "value2": "={{$node[\"count registros\"].data[\"total\"]}}"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "25db3def-637b-4e50-82e1-a66821b27d0c",
      "name": "count registros",
      "type": "n8n-nodes-base.mySql",
      "position": [
        -540,
        -320
      ],
      "parameters": {
        "query": "select count(*) as total \nfrom investments i\n         inner join profiles p on i.investable_id = p.id and i.investable_type = \"Profile\"\nwhere state in\n      (\"active\", \"paid\", \"legal_collection_completed\", \"legal_collection\", \"waiting_completion\",\n       \"completed\")",
        "operation": "executeQuery"
      },
      "credentials": {
        "mySql": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9d8cbd93-0cc0-44d8-95d0-bbc3ef3bfdd3",
      "name": "Set start",
      "type": "n8n-nodes-base.set",
      "position": [
        -40,
        -320
      ],
      "parameters": {
        "values": {
          "number": [
            {
              "name": "start"
            }
          ]
        },
        "options": {}
      },
      "executeOnce": true,
      "typeVersion": 2
    }
  ],
  "connections": {
    "IF": {
      "main": [
        [
          {
            "node": "Execute Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set1": {
      "main": [
        [
          {
            "node": "IF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set start": {
      "main": [
        [
          {
            "node": "Execute Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "clear sheet": {
      "main": [
        [
          {
            "node": "Set start",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "count registros": {
      "main": [
        [
          {
            "node": "clear sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Workflow": {
      "main": [
        [
          {
            "node": "Set1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \"Execute Workflow\"": {
      "main": [
        [
          {
            "node": "count registros",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "callerPolicy": "workflowsFromSameOwner",
    "saveManualExecutions": true,
    "saveExecutionProgress": true
  },
  "staticData": null,
  "versionId": "e9d9f4c5-b8aa-4943-8cdc-abca12836c3f",
  "triggerCount": 0,
  "tags": []
}