How to extract n'th "row" of a result

Hi,

I have a workflow that outputs this JSON out of an Item List:

[
  {
    "title": "2022-12-19",
    "table_name": "nc_qg1p__2022-12-19"
  },
  {
    "title": "2022-12-20",
    "table_name": "nc_qg1p__2022-12-20"
  },
  {
    "title": "2022-12-21",
    "table_name": "nc_qg1p__2022-12-21"
  },
  {
    "title": "2022-12-22",
    "table_name": "nc_qg1p__2022-12-22"
  },
  {
    "title": "2022-12-23",
    "table_name": "nc_qg1p__2022-12-23"
  }
]

I am trying to work out how to create some kind of function to extract the last and second last records returned.

I don’t think there’s any built in functions and my JavaScript is not good enough yet. Has anyone done this before?

Welcome to the community @thermonuclear_pickle!

Are they really totally separate items in the n8n sense, or is it an array in an item?
So does the arrow pointing out of the node say “1 item” or “5 items”?

Hi @jan ,

It says 5 items. What I’m dealing with (for context) is a daily license audit of Office 365 licenses for a 3000-user franchise.

Every day I dump license data into a NocoDB table with today’s date format (2022-12-21). And every day I need to run a differencing function on today and the day before to work out license changes.

As such, I need to get the last & second-to-last “rows” returned in my NocoDB query which returns the values in the JSON above.

Thanks.

You can do that with the Item Lists node (Operation: “Limit”, Max Items: 2):

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.