How can I upsert a datatable current numeric value

Describe the problem/error/question

i do have a simple workflow that reads my gmail and aggretates email by number of occurences, and the idea is to store them in a datatable.

The datatable just holds : email, total_ocurrences.

When the email is not present, it just upserts the column total_ocurrences with the incoming value from the previous node, json.total_ocurrences, for the same given email.

But when the email is already present, the upsert must read the current row total_ocurrences and increase it by the incoming json.total_ocurrences.

I haven’t found any mean to read current datatable row column, ¿ how can it be read ?

What is the error message (if any)? None,

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 1.118.0
  • Database (default: SQLite): Sqlite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own
  • Running n8n via (Docker, npm, n8n cloud, desktop app): nom
  • Operating system: linux

There might be a better way, but I would replace the Upsert with a forked path for the row existing or not and then merge afterward. That way you can reference the existing value if the row is there.

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