IF True, Modify and Add Row

I’m trying to build a to-do list with recurring tasks. I have a “Recurring” column where I can put in the number of days I would like the task to recur. When I hit the “Completed” button, it triggers an IF formula that figures out if the “Recurring” column is greater than zero. If it isn’t, it treats it as a normal task and just marks it complete. If it is greater than zero, it is considered a recurring task, which triggers an “Addrow”, which basically duplicates the active row. I would like to also modify the active row, marking it complete, but I can’t figure out how to create a formula that does both Modifyrow and Addrow.

Here’s the formula that I’ve built so far.

if(thisRow.Recurring>0,AND((AddRow(thisTable,thisTable.Category,“Recurring”,thisTable.Status,“Active”,thisTable.Task,thisRow.Task,thisTable.[Start Date],thisRow.[Start Date]+thisRow.Recurring,thisTable.[End Date],thisRow.[End Date]+thisRow.Recurring,thisRow.Recurring,thisRow.Recurring)),(modifyRows(thisRow,thisRow.Status,“Complete”))),ModifyRows(thisRow, Tasks.[End Date], Today(), Tasks.Status,“Complete”))

Here’s a copy of the Doc as well:

Thanks for the help!

1 Like

Can you share this doc, right now it says “Request Access”.

Sure! My bad. Here’s the link as well if you want to open it up: https://coda.io/d/Tasks_dtS3MBIf1U7

Give this formula a try for the button action. It uses RunActions() which is a way to run multiple button actions in one button. For your first request at the top, you’re asking to run one type of action to add a row and have values filled in, then a second action to modify the current row. RunActions() lets us create a comma separated list for this: RunActions(AddRow(), ModifyRows()). Then we put this into your If() statement.

    thisTable.[Start Date],thisRow.[Start Date]+thisRow.Recurring,
    thisTable.[End Date],thisRow.[End Date]+thisRow.Recurring,
    thisRow.[End Date],Today()

Awesome. Thank you so much for the help!!!

1 Like