Get the value of item [1], item [2], item [

Hi Expert,
i am new to n8n, i am using google calendar in my flow and when there is a new event created, i need to check the event description to see whether there is a duplicated event already in the calendar.

sometimes my colleagues will submit the events with same description to me 2 times, 3times or 4times or more times.(so there is an array). And i just want to keep the first created event, but want to delete 2, 3, or 4, or more events. (so my calendar has only 1 entry for 1 event),

Until now, i can identify number of duplicate entry, but i dont know the way to delete the others events and only keep the first event, can you guide give me some hints??

Hi @Louis_kwok, welcome to the community!

If have multiple items but only want to keep the first one, check out the Item Lists node. It has a limit operation which only keeps a specified number of items:

image

Yes Man, thanks for your help , i understand the “limit”, however, the entries is still on my google calendar , so i need to identify the event Id and delete the id from the google calendar.

For example, i can ceate a iten list array

{
eventid1
eventid2
eventid3
eventid4
eventid5
}

and i need to keep the eventid1 and for the rest, i need to delete it in google calendar, i have no idea on how to take out the eventid1 from the array

thanks

Ah sorry, I didn’t understand that from your initial message.

You can still use an Item Lists node to keep all items but the first one. Simply use an expression like {{$items().length - 1}} in the Max Items field and set Keep to Last Items.

image

You should then have all the Google Calendar items you want to remove from Google Calendar.

1 Like

Hi buddie, it works, thank you my friend!!

1 Like

Glad to hear, thanks for confirming!