Hi TB Community,
I am creating a snippet which shows a checklist of tasks that need to get done- some of these tasks will be daily re-occuring tasks. This snippet will be linked to a DB table which will list all of the tasks and their respective category ie - "one time" or "daily"
I am wondering if there is a way to create a timer within this snippet that marks all the tasks designated as daily to "not done" or blank everyday at 130am or something like this. I am also open to just "running"/inserting the snippet once in the morning to clear all of these fields, but is there some way to mark that it has been completed for the day and not run again until the next day?
I also tried to create a Zap in Zapier which runs everyday - I just wasn't sure how to get it to update all the rows/tasks marked/labeled as daily
Thank you for any creative solutions to this problem!
Hi @ajduna7
Does something like this works?
{today=now()}
{dbselect: SELECT `task name`,occurrence,due,completed,rowid() as rowid FROM Tasks where due > "2020-01-01"; space=id; multiple=yes; name=tasks}
{repeat: for task in tasks}{note: preview=no}
{if: task.occurrence = "One time"}
{due_start_date="1990-02-02"}
{due_end_date=task.due}
{elseif: task.occurrence = "Daily"}
{due_date=datetimeformat(today, "YYYY-MM-DD") & " " & datetimeformat(task.due, "HH:MM")}
{if: due_date > today}
{due_end_date=due_date}
{due_start_date=datetimeadd(due_date, -1, "D")}
{else}
{due_start_date=due_date}
{due_end_date=datetimeadd(due_start_date, 1, "D")}
{endif}
{elseif: task.occurrence = "Weekly"}
{dueday=datetimeformat(task.due, "DDD")}
{currentday=datetimeformat(today, "DDD")}
{due_date=datetimeadd(today, dueday-currentday, "D")}
{if: due_date > today}
{due_end_date=due_date}
{due_start_date=datetimeadd(due_date, -7, "D")}
{else}
{due_start_date=due_date}
{due_end_date=datetimeadd(due_start_date, 7, "D")}
{endif}
{elseif: task.occurrence = "Monthly"}
{duedate=datetimeformat(task.due, "D")}
{currentdate=datetimeformat(today, "D")}
{due_date=datetimeadd(today, duedate-currentdate, "D")}
{if: due_date > today}
{due_end_date=due_date}
{due_start_date=datetimeadd(due_date, -30, "D")}
{else}
{due_start_date=due_date}
{due_end_date=datetimeadd(due_start_date, 30, "D")}
{endif}
{endif}
{endnote}{if: (
task.completed = ""
or task.completed < due_start_date
)}{formtoggle}{dbupdate: UPDATE Tasks set completed=@today where rowid() = {=task.rowid}; space=id}{endformtoggle}{=task["task name"]} ({=task.occurrence}) by {=due_end_date}{else}{=task["task name"]} ({=task.occurrence}) on {=task.completed}{endif}
{endrepeat}
1 Like