{
  "format": "chatigram-workflow",
  "version": 1,
  "metadata": {
    "sourceName": "Count daily operations records",
    "importHelp": {
      "note": "Setup required. Select the database/table, add the filters that define your reporting period, and review the schedule. Choose any downstream delivery step separately. Placeholder endpoints use example.invalid and cannot call a real business service. Keep the workflow disabled until you finish the setup and review its effects."
    }
  },
  "workflow": {
    "instruction": null,
    "multiLanguageSupport": null,
    "properties": [],
    "trigger": {
      "$tag": "Trigger",
      "type": "CRON",
      "data": {
        "cronExpression": "0 0 9 * * ?",
        "timezone": "UTC",
        "mode": "advanced"
      }
    },
    "nodes": [
      {
        "$tag": "Node",
        "id": "d0c00000-0000-4000-8000-000000000001",
        "name": "countRecords",
        "parentId": null,
        "branchIndex": 0,
        "type": "DATABASE_AGGREGATE_ROWS",
        "data": {
          "databaseId": null,
          "tableId": null,
          "columns": [],
          "aggregation": "COUNT",
          "columnKey": null,
          "combinator": "AND",
          "filters": []
        }
      },
      {
        "$tag": "Node",
        "id": "d0c00000-0000-4000-8000-000000000004",
        "name": "operationSucceeded",
        "parentId": "d0c00000-0000-4000-8000-000000000001",
        "branchIndex": 0,
        "type": "IF_STATEMENT",
        "data": {
          "condition": {
            "$tag": "StringComparison",
            "operator": "IS_EMPTY",
            "variable": "countRecords.error",
            "rightOperand": {
              "$tag": "Constant",
              "value": ""
            },
            "ignoreCase": false,
            "valueType": "TEXT"
          }
        }
      },
      {
        "$tag": "Node",
        "id": "d0c00000-0000-4000-8000-000000000002",
        "name": "total",
        "parentId": "d0c00000-0000-4000-8000-000000000004",
        "branchIndex": 0,
        "type": "SET_VARIABLE",
        "data": {
          "variableValue": [
            {
              "$tag": "Variable",
              "name": "countRecords.result"
            }
          ]
        }
      },
      {
        "$tag": "Node",
        "id": "d0c00000-0000-4000-8000-000000000003",
        "name": "countFailure",
        "parentId": "d0c00000-0000-4000-8000-000000000004",
        "branchIndex": 1,
        "type": "SET_VARIABLE",
        "data": {
          "variableValue": [
            {
              "$tag": "Constant",
              "value": "The count could not be calculated."
            }
          ]
        }
      }
    ],
    "gotos": []
  }
}
