[Bug] Notion formula not calculated correctly in n8n

Values returned from the following formula are incorrect
if(dateBetween(now(), prop(“Created”), “hours”) >= if(empty(prop(“Responded”)), toNumber(prop(“SLA resp target”)), min(prop(“Hours to respond”), toNumber(prop(“SLA resp target”)))) + toNumber(prop(“SLA resol target”)) and empty(prop(“Resolved”)), “:broken_heart:OVERDUE”, “”)
Notion displays correctly “:broken_heart:OVERDUE” according to the formula, but n8n finds “:broken_heart:OVERDUE” when it shouldn’t i.e. when “Resolved” is empty but hours are not >= condition given.
Is it because “SLA resp target” and “SLA resol target” are rollups - from another table?

Welcome to the community @ajcairns

If you do set simple to false, does the value come correctly? Because if even when simple is set to false you get the same problem then the issue is with the Notion API and not with n8n.

Basically I’m obtaining 7 trues and 5 falses. 2 of the trues should also be false. In Notion Overdue field the formula correctly produces 7 empty strings and 5 with “:broken_heart:OVERDUE”, but when I look in the JSON data input to the if statement, there are 7 “:broken_heart:OVERDUE” strings. So I don’t know where things are going wrong. Is the formula carried out in Notion API or in n8n?

Thanks Ricardo, I found the problem. One of the related tables wasn’t shared to n8n. When I added the share, it worked correctly :slight_smile:

2 Likes

Screenshot_1
hello. i saw same problem . i try many solves. i found one . some long. and i take one date. (2000 year). and i calculated between 2000 to now date. result as day.

(toNumber(formatDate(prop(“End”), “YYYY”)) - 2000) * 365 + toNumber(formatDate(prop(“End”), “MM”)) * 30 + toNumber(formatDate(prop(“End”), “DD”)) - ((toNumber(formatDate(now(), “YYYY”)) - 2000) * 365 + toNumber(formatDate(now(), “MM”)) * 30 + toNumber(formatDate(now(), “DD”)))