If node seemingly not comparing numbers

Hi

I have an IF node that doesn’t appear to be comparing two numbers correctly.

I’m getting paginated HTTP data and appending the results to a Google Spreadsheet. There is an IF node which should check that the current page number is smaller than the total page number. If smaller, increment the page number and repeat; else end.

However, the loop keeps running:


(See the Set node after the IF false is being reached)

Any advice would be appreciated.

Typical response format

[
  {
    "currentPage": 1,
    "totalItems": 7329,
    "totalPages": 294,
    "items": [
      {
        "id": 8025216,
        "eventId": 516682,
        "siteUnitNumber": 12616,
        "bathingSite": "GURNARD",
        "eventStart": "2021-10-31T08:18:25",
        "eventStop": "2021-11-05T06:00:01.13",
        "duration": 7061,
        "activity": "Not Reviewed",
        "associatedSiteId": 109650,
        "outfallName": "MARSH ROAD GURNARD"
      },
      {
        "id": 8025217,
        "eventId": 516682,
        "siteUnitNumber": 12617,
        "bathingSite": "COWES",
        "eventStart": "2021-10-31T08:18:25",
        "eventStop": "2021-11-05T06:00:01.13",
        "duration": 7061,
        "activity": "Not Reviewed",
        "associatedSiteId": 109650,
        "outfallName": "MARSH ROAD GURNARD"
      },
      {
        "id": 8025218,
        "eventId": 519475,
        "siteUnitNumber": 12617,
        "bathingSite": "COWES",
        "eventStart": "2021-11-04T22:45:00",
        "eventStop": "2021-11-04T23:15:00",
        "duration": 30,
        "activity": "Not Reviewed",
        "associatedSiteId": 109700,
        "outfallName": "MARKET HILL COWES"
      },
      {
        "id": 8025219,
        "eventId": 519475,
        "siteUnitNumber": 12616,
        "bathingSite": "GURNARD",
        "eventStart": "2021-11-04T22:45:00",
        "eventStop": "2021-11-04T23:15:00",
        "duration": 30,
        "activity": "Not Reviewed",
        "associatedSiteId": 109700,
        "outfallName": "MARKET HILL COWES"
      },
      {
        "id": 8025220,
        "eventId": 519474,
        "siteUnitNumber": 12616,
        "bathingSite": "GURNARD",
        "eventStart": "2021-11-04T22:00:00",
        "eventStop": "2021-11-04T22:15:00",
        "duration": 15,
        "activity": "Not Reviewed",
        "associatedSiteId": 109700,
        "outfallName": "MARKET HILL COWES"
      },
      {
        "id": 8025221,
        "eventId": 519474,
        "siteUnitNumber": 12617,
        "bathingSite": "COWES",
        "eventStart": "2021-11-04T22:00:00",
        "eventStop": "2021-11-04T22:15:00",
        "duration": 15,
        "activity": "Not Reviewed",
        "associatedSiteId": 109700,
        "outfallName": "MARKET HILL COWES"
      },
      {
        "id": 8025222,
        "eventId": 519307,
        "siteUnitNumber": 12609,
        "bathingSite": "LEPE",
        "eventStart": "2021-11-04T12:20:48",
        "eventStop": "2021-11-04T12:39:00",
        "duration": 18,
        "activity": "Not Reviewed",
        "associatedSiteId": 109825,
        "outfallName": "WEST COMMON FAWLEY"
      },
      {
        "id": 8025223,
        "eventId": 519129,
        "siteUnitNumber": 12549,
        "bathingSite": "HERNE BAY CENTRAL",
        "eventStart": "2021-11-03T20:40:50",
        "eventStop": "2021-11-03T21:12:14",
        "duration": 31,
        "activity": "Reviewed",
        "associatedSiteId": 109830,
        "outfallName": "SWALECLIFFE NO1"
      },
      {
        "id": 8025224,
        "eventId": 519129,
        "siteUnitNumber": 12548,
        "bathingSite": "TANKERTON",
        "eventStart": "2021-11-03T20:40:50",
        "eventStop": "2021-11-03T21:12:14",
        "duration": 31,
        "activity": "Reviewed",
        "associatedSiteId": 109830,
        "outfallName": "SWALECLIFFE NO1"
      },
      {
        "id": 8025225,
        "eventId": 519237,
        "siteUnitNumber": 12593,
        "bathingSite": "FELPHAM",
        "eventStart": "2021-11-02T18:22:00",
        "eventStop": "2021-11-02T23:23:00",
        "duration": 301,
        "activity": "Reviewed",
        "associatedSiteId": 110095,
        "outfallName": "LIDSEY"
      },
      {
        "id": 8025226,
        "eventId": 518795,
        "siteUnitNumber": 12593,
        "bathingSite": "FELPHAM",
        "eventStart": "2021-11-02T14:37:00",
        "eventStop": "2021-11-02T16:18:00",
        "duration": 101,
        "activity": "Reviewed",
        "associatedSiteId": 110095,
        "outfallName": "LIDSEY"
      },
      {
        "id": 8025227,
        "eventId": 518702,
        "siteUnitNumber": 12593,
        "bathingSite": "FELPHAM",
        "eventStart": "2021-11-02T09:36:38",
        "eventStop": "2021-11-02T12:24:00",
        "duration": 167,
        "activity": "Reviewed",
        "associatedSiteId": 110095,
        "outfallName": "LIDSEY"
      },
      {
        "id": 8025228,
        "eventId": 518232,
        "siteUnitNumber": 12593,
        "bathingSite": "FELPHAM",
        "eventStart": "2021-11-01T07:23:08",
        "eventStop": "2021-11-02T00:24:00",
        "duration": 1020,
        "activity": "Reviewed",
        "associatedSiteId": 110095,
        "outfallName": "LIDSEY"
      },
      {
        "id": 8025229,
        "eventId": 518684,
        "siteUnitNumber": 12661,
        "bathingSite": "LANGSTONE HARBOUR",
        "eventStart": "2021-11-01T16:21:00",
        "eventStop": "2021-11-01T23:30:00",
        "duration": 429,
        "activity": "Reviewed",
        "associatedSiteId": 109773,
        "outfallName": "BUDDS FARM HAVANT NO2"
      },
      {
        "id": 8025230,
        "eventId": 518798,
        "siteUnitNumber": 12622,
        "bathingSite": "WHITECLIFF BAY",
        "eventStart": "2021-11-01T19:15:00",
        "eventStop": "2021-11-01T22:32:00",
        "duration": 197,
        "activity": "Reviewed",
        "associatedSiteId": 110096,
        "outfallName": "SANDOWN NO1"
      },
      {
        "id": 8025231,
        "eventId": 518798,
        "siteUnitNumber": 12623,
        "bathingSite": "YAVERLAND",
        "eventStart": "2021-11-01T19:15:00",
        "eventStop": "2021-11-01T22:32:00",
        "duration": 197,
        "activity": "Reviewed",
        "associatedSiteId": 110096,
        "outfallName": "SANDOWN NO1"
      },
      {
        "id": 8025232,
        "eventId": 518798,
        "siteUnitNumber": 12624,
        "bathingSite": "SANDOWN",
        "eventStart": "2021-11-01T19:15:00",
        "eventStop": "2021-11-01T22:32:00",
        "duration": 197,
        "activity": "Reviewed",
        "associatedSiteId": 110096,
        "outfallName": "SANDOWN NO1"
      },
      {
        "id": 8025233,
        "eventId": 518574,
        "siteUnitNumber": 12582,
        "bathingSite": "SEAFORD",
        "eventStart": "2021-11-01T21:50:00",
        "eventStop": "2021-11-01T22:08:00",
        "duration": 18,
        "activity": "Reviewed",
        "associatedSiteId": 110920,
        "outfallName": "NEWHAVEN"
      },
      {
        "id": 8025234,
        "eventId": 518797,
        "siteUnitNumber": 12622,
        "bathingSite": "WHITECLIFF BAY",
        "eventStart": "2021-11-01T17:27:00",
        "eventStop": "2021-11-01T19:10:00",
        "duration": 103,
        "activity": "Reviewed",
        "associatedSiteId": 110096,
        "outfallName": "SANDOWN NO1"
      },
      {
        "id": 8025235,
        "eventId": 518797,
        "siteUnitNumber": 12624,
        "bathingSite": "SANDOWN",
        "eventStart": "2021-11-01T17:27:00",
        "eventStop": "2021-11-01T19:10:00",
        "duration": 103,
        "activity": "Reviewed",
        "associatedSiteId": 110096,
        "outfallName": "SANDOWN NO1"
      },
      {
        "id": 8025236,
        "eventId": 518797,
        "siteUnitNumber": 12623,
        "bathingSite": "YAVERLAND",
        "eventStart": "2021-11-01T17:27:00",
        "eventStop": "2021-11-01T19:10:00",
        "duration": 103,
        "activity": "Reviewed",
        "associatedSiteId": 110096,
        "outfallName": "SANDOWN NO1"
      },
      {
        "id": 8025237,
        "eventId": 518497,
        "siteUnitNumber": 12623,
        "bathingSite": "YAVERLAND",
        "eventStart": "2021-11-01T17:40:00",
        "eventStop": "2021-11-01T19:02:14",
        "duration": 82,
        "activity": "Reviewed",
        "associatedSiteId": 110097,
        "outfallName": "SANDOWN NO2"
      },
      {
        "id": 8025238,
        "eventId": 518497,
        "siteUnitNumber": 12624,
        "bathingSite": "SANDOWN",
        "eventStart": "2021-11-01T17:40:00",
        "eventStop": "2021-11-01T19:02:14",
        "duration": 82,
        "activity": "Reviewed",
        "associatedSiteId": 110097,
        "outfallName": "SANDOWN NO2"
      },
      {
        "id": 8025239,
        "eventId": 518497,
        "siteUnitNumber": 12622,
        "bathingSite": "WHITECLIFF BAY",
        "eventStart": "2021-11-01T17:40:00",
        "eventStop": "2021-11-01T19:02:14",
        "duration": 82,
        "activity": "Reviewed",
        "associatedSiteId": 110097,
        "outfallName": "SANDOWN NO2"
      },
      {
        "id": 8025240,
        "eventId": 518488,
        "siteUnitNumber": 12622,
        "bathingSite": "WHITECLIFF BAY",
        "eventStart": "2021-11-01T15:56:00",
        "eventStop": "2021-11-01T17:21:00",
        "duration": 85,
        "activity": "Reviewed",
        "associatedSiteId": 110096,
        "outfallName": "SANDOWN NO1"
      }
    ]
  }
]

Workflow

Hi @theneilkirk, I’m sorry to hear you’re running into this behaviour. I’d need to give your specific workflow a go later today (unless someone else beats me to it, of course). Can you confirm if the example output you have provided is from your HTTP Request node or from another node?

The first thing that comes to mind without looking into this in too much depth is that the if node runs once for each item it receives, so if your Add to Sheet node outputs multiple items that might be the culprit here.

On the general question whether the IF node might not be comparing numbers correctly, I have put together a quick workflow going through multiple pages and it seems to be working fine:

Example Workflow

1 Like

You were totally right. I simply changed the flow to split after the HTTP request: one branch to the IF node and the other branch to the Function. Worked perfectly.

Thank you!

1 Like