Notion Answers

Help between Notion users


Register & Ask

It's free & easy

Get answers

Answers, votes & comments

Vote and select answers

Receive points, vote and give the solution

Question

0vote

Why am I getting "Too few arguments in function if" error?

I apologize for how clunky it is.

if(not empty(prop("Recur Interval")) and not empty(prop("Due")), if(prop("Recur Interval") > 0 and prop("Recur Interval") == ceil(prop("Recur Interval")), formatDate(if(length(prop("Days (Only if Set to 1 Day(s))")) > 0 and prop("Recur Unit") == "Day(s)" and prop("Recur Interval") == 1, if(dateBetween(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, if(test(format(prop("Due")), "AM|PM"), now(), dateAdd(now(), prop("UTC Offset"), "hours")), now()), now()), prop("Due"), "days") >= 1 and unequal(formatDate(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, dateAdd(now(), prop("UTC Offset"), "hours"), now()), now()), "MMMM D, YYYY"), formatDate(prop("Due"), "MMMM D, YYYY")), if(length(replaceAll(replaceAll(prop("Days (Only if Set to 1 Day(s))"), formatDate(dateAdd(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, dateAdd(now(), prop("UTC Offset"), "hours"), now()), now()), 1, "days"), "dddd"), "§"), "[^§]", "")) > 0, dateAdd(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, dateAdd(now(), prop("UTC Offset"), "hours"), now()), now()), 1, "days"), if(length(replaceAll(replaceAll(prop("Days (Only if Set to 1 Day(s))"), formatDate(dateAdd(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, dateAdd(now(), prop("UTC Offset"), "hours"), now()), now()), 2, "days"), "dddd"), "§"), "[^§]", "")) > 0, dateAdd(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, dateAdd(now(), prop("UTC Offset"), "hours"), now()), now()), 2, "days"), if(length(replaceAll(replaceAll(prop("Days (Only if Set to 1 Day(s))"), formatDate(dateAdd(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, dateAdd(now(), prop("UTC Offset"), "hours"), now()), now()), 3, "days"), "dddd"), "§"), "[^§]", "")) > 0, dateAdd(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, dateAdd(now(), prop("UTC Offset"), "hours"), now()), now()), 3, "days"), if(length(replaceAll(replaceAll(prop("Days (Only if Set to 1 Day(s))"), formatDate(dateAdd(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, dateAdd(now(), prop("UTC Offset"), "hours"), now()), now()), 4, "days"), "dddd"), "§"), "[^§]", "")) > 0, dateAdd(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, dateAdd(now(), prop("UTC Offset"), "hours"), now()), now()), 4, "days"), if(length(replaceAll(replaceAll(prop("Days (Only if Set to 1 Day(s))"), formatDate(dateAdd(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, dateAdd(now(), prop("UTC Offset"), "hours"), now()), now()), 5, "days"), "dddd"), "§"), "[^§]", "")) > 0, dateAdd(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, dateAdd(now(), prop("UTC Offset"), "hours"), now()), now()), 5, "days"), if(length(replaceAll(replaceAll(prop("Days (Only if Set to 1 Day(s))"), formatDate(dateAdd(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, dateAdd(now(), prop("UTC Offset"), "hours"), now()), now()), 6, "days"), "dddd"), "§"), "[^§]", "")) > 0, dateAdd(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, dateAdd(now(), prop("UTC Offset"), "hours"), now()), now()), 6, "days"), if(length(replaceAll(replaceAll(prop("Days (Only if Set to 1 Day(s))"), formatDate(dateAdd(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, dateAdd(now(), prop("UTC Offset"), "hours"), now()), now()), 7, "days"), "dddd"), "§"), "[^§]", "")) > 0, dateAdd(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, dateAdd(now(), prop("UTC Offset"), "hours"), now()), now()), 7, "days"), fromTimestamp(9.07002e+11)))))))), if(length(replaceAll(replaceAll(prop("Days (Only if Set to 1 Day(s))"), formatDate(dateAdd(prop("Due"), 1, "days"), "dddd"), "§"), "[^§]", "")) > 0, dateAdd(prop("Due"), 1, "days"), if(length(replaceAll(replaceAll(prop("Days (Only if Set to 1 Day(s))"), formatDate(dateAdd(prop("Due"), 2, "days"), "dddd"), "§"), "[^§]", "")) > 0, dateAdd(prop("Due"), 2, "days"), if(length(replaceAll(replaceAll(prop("Days (Only if Set to 1 Day(s))"), formatDate(dateAdd(prop("Due"), 3, "days"), "dddd"), "§"), "[^§]", "")) > 0, dateAdd(prop("Due"), 3, "days"), if(length(replaceAll(replaceAll(prop("Days (Only if Set to 1 Day(s))"), formatDate(dateAdd(prop("Due"), 4, "days"), "dddd"), "§"), "[^§]", "")) > 0, dateAdd(prop("Due"), 4, "days"), if(length(replaceAll(replaceAll(prop("Days (Only if Set to 1 Day(s))"), formatDate(dateAdd(prop("Due"), 5, "days"), "dddd"), "§"), "[^§]", "")) > 0, dateAdd(prop("Due"), 5, "days"), if(length(replaceAll(replaceAll(prop("Days (Only if Set to 1 Day(s))"), formatDate(dateAdd(prop("Due"), 6, "days"), "dddd"), "§"), "[^§]", "")) > 0, dateAdd(prop("Due"), 6, "days"), if(length(replaceAll(replaceAll(prop("Days (Only if Set to 1 Day(s))"), formatDate(dateAdd(prop("Due"), 7, "days"), "dddd"), "§"), "[^§]", "")) > 0, dateAdd(prop("Due"), 7, "days"), fromTimestamp(9.07002e+11))))))))), if(prop("Recur Unit") == "Month(s) on the Last Day", prop("Last Day Base Date"), if(prop("Recur Unit") == "Month(s) on the Last Weekday", if(dateBetween(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, if(test(format(prop("Due")), "AM|PM"), now(), dateAdd(now(), prop("UTC Offset"), "hours")), now()), now()), prop("Last Weekday Base Date"), "days") >= 1 or equal(formatDate(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, dateAdd(now(), prop("UTC Offset"), "hours"), now()), now()), "L"), formatDate(prop("Last Weekday Base Date"), "L")), if(day(prop("Next Last Base Date")) == 0, dateSubtract(prop("Next Last Base Date"), 2, "days"), if(day(prop("Next Last Base Date")) == 6, dateSubtract(prop("Next Last Base Date"), 1, "days"), prop("Next Last Base Date"))), prop("Last Weekday Base Date")), if(prop("Recur Unit") == "Month(s) on the First Weekday", if(dateBetween(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, if(test(format(prop("Due")), "AM|PM"), now(), dateAdd(now(), prop("UTC Offset"), "hours")), now()), now()), prop("First Weekday Base Date"), "days") >= 1 or equal(formatDate(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, dateAdd(now(), prop("UTC Offset"), "hours"), now()), now()), "L"), formatDate(prop("First Weekday Base Date"), "L")), if(day(dateSubtract(prop("Next Last Base Date"), date(prop("Next Last Base Date")) - 1, "days")) == 0, dateSubtract(prop("Next Last Base Date"), date(prop("Next Last Base Date")) - 2, "days"), if(day(dateSubtract(prop("Next Last Base Date"), date(prop("Next Last Base Date")) - 1, "days")) == 6, dateSubtract(prop("Next Last Base Date"), date(prop("Next Last Base Date")) - 3, "days"), dateSubtract(prop("Next Last Base Date"), date(prop("Next Last Base Date")) - 1, "days"))), prop("First Weekday Base Date")), if(dateBetween(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, if(test(format(prop("Due")), "AM|PM"), now(), dateAdd(now(), prop("UTC Offset"), "hours")), now()), now()), prop("Due"), "days") >= 1 and unequal(formatDate(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, dateAdd(now(), prop("UTC Offset"), "hours"), now()), now()), "L"), formatDate(prop("Due"), "L")), if(equal(dateBetween(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, if(test(format(prop("Due")), "AM|PM"), now(), dateAdd(now(), prop("UTC Offset"), "hours")), now()), now()), prop("Due"), prop("Simplified Recur Unit")) / prop("Recur Interval"), ceil(dateBetween(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, if(test(format(prop("Due")), "AM|PM"), now(), dateAdd(now(), prop("UTC Offset"), "hours")), now()), now()), prop("Due"), prop("Simplified Recur Unit")) / prop("Recur Interval"))), dateAdd(prop("Due"), multiply(dateBetween(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, if(test(format(prop("Due")), "AM|PM"), now(), dateAdd(now(), prop("UTC Offset"), "hours")), now()), now()), prop("Due"), prop("Simplified Recur Unit")) / prop("Recur Interval") + 1, prop("Recur Interval")), prop("Simplified Recur Unit")), dateAdd(prop("Due"), multiply(ceil(dateBetween(if(formatDate(now(), "z") == "UTC", if(not empty(prop("UTC Offset")) and prop("UTC Offset") >= -12 and prop("UTC Offset") <= 14, if(test(format(prop("Due")), "AM|PM"), now(), dateAdd(now(), prop("UTC Offset"), "hours")), now()), now()), prop("Due"), prop("Simplified Recur Unit")) / prop("Recur Interval")), prop("Recur Interval")), prop("Simplified Recur Unit"))), dateAdd(prop("Due"), prop("Recur Interval"), prop("Simplified Recur Unit"))))))), "MMMM D, YYYY"), "Error in Recur Interval: Non-Whole or Negative Number"), "")

1 Answer

0vote

polle Points94310

See my answer in this question.

Please log in or register to answer this question.

...

Welcome to Notion Answers, where you can ask questions and receive answers from other members of the community.

Please share to grow the Notion Community!

Connect