New to n8n and having trouble with the "compare" module

Describe the issue/error/question

I am trying to create a 2-way sync between a “Task” table in my Airtable base, and my Microsoft To Do account.

I have a Compare Dataset module in my workflow, but due to some nuances of how tasks are created, it’s never displaying any tasks as shared. I think this is due to very slight differences in how the Date and Notes fields are created. I have included an example below.

That said - is there any way to standardize these in the workflow so that it both matches, and identifies mismatches, better?

Please share the workflow

Share the output returned by the last node

((I’ve removed all records but the ones that I care about since they contain personal information))

In A Branch Only:

Task dueDateTime Notes
testing123 2023-03-22T21:54:00.000-04:00 [undefined]

In B Branch Only:

Task Due Date Notes
testing123 2023-03-22T04:00:00.0000000 [empty]

As you can see, the dates and the notes are different for each of these due to nuances of how they’re created. I want them to be identified as the same task.

This is occurring for essentially every task that I create on either side, preventing me from having a true two way sync.

Information on your n8n setup

  • n8n version:
  • Database you’re using (default: SQLite):
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]:

Hi @Glorysk87, welcome to the community :tada:

Seeing your example values are timestamps I’d suggest parsing them with Luxon and then returning them in a specified format. Here’s a quick example workflow showing how this can be done in a Set node:

The {{ DateTime.fromISO($json["My Timestamp"]).toISO() }} expression should return an identical format for both values:

The values themselves would, however, still differ as they represent different points in time. So you could consider looking only at the date portion rather than the time if you want these to match. An expression that simply cuts off everything after the first 10 characters would be {{ $json["My Timestamp"].substring(0, 10) }} (using the substring() method provided by JavaScript):

Hope this helps! Let me know if you have any questions on the above :slight_smile:

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