How to create a recurring task based on custom values
Creating Dynamic Recurring Tasks in Tadabase
In this article, we’ll walk you through creating a dynamic recurring task in Tadabase. This setup allows you to determine if a task should run today based on specific values in a record. By the end, you’ll have a working equation that dynamically calculates task schedules based on recurrence fields.
This solution can help you run a single task and filter it to only trigger on records that are scheduled to happen today.
Fields Required
To build this setup, you’ll need the following fields:
-
Recurring: A field to indicate whether the task is recurring (e.g., a checkbox or toggle).
-
Frequency: A field to specify how often the task recurs (e.g., 'daily', 'weekly', 'monthly').
-
Day of the Week: A field to capture the day of the week for weekly tasks (e.g., Sunday, Monday, etc.).
-
Day of the Month: A field to specify the day of the month for monthly tasks (1-31).
- Current Date: An equation field that sets the current date.
The Equation
Here is the complete equation to determine if today is the day the task should run:
IF({Recurring} = 1 AND {Frequency} = 'daily',
1,
IF({Recurring} = 1 AND {Frequency} = 'weekly' && DAYOFWEEK({Current Date}) =
IF({Day of Week} = 'Sunday', 1,
IF({Day of Week} = 'Monday', 2,
IF({Day of Week} = 'Tuesday', 3,
IF({Day of Week} = 'Wednesday', 4,
IF({Day of Week} = 'Thursday', 5,
IF({Day of Week} = 'Friday', 6,
IF({Day of Week} = 'Saturday', 7, NULL)
)
)
)
)
)
),
1,
IF({Recurring} = 1 AND {Frequency} = 'monthly' && DAYOFMONTH({Current Date}) = {Day of the Month},
1,
0
)
)
)
Breakdown of the Equation
-
Daily Tasks:
-
If
{Recurring}
is checked and{Frequency}
is set to 'daily', the task is due today (1
).
-
-
Weekly Tasks:
-
Checks if
{Recurring}
is checked and{Frequency}
is 'weekly'. -
Uses
DAYOFWEEK(CURDATE())
to determine if today matches the day stored in the{Day of the Week}
field. -
Maps days of the week (e.g., Sunday = 1, Monday = 2) to their respective numeric values.
-
-
Monthly Tasks:
-
If
{Recurring}
is checked and{Frequency}
is 'monthly', it checks if today’s date (DAYOFMONTH(CURDATE())
) matches the value in{Day of the Month}
.
-
-
Default Case:
-
If none of the conditions are met, the output is
0
(not due today).
-
How to Implement
Step 1: Create the Fields
-
Add a Decision Field field for
Recurring
. -
Add a Select Dropdown field for
Frequency
with options:-
'daily'
-
'weekly'
-
'monthly'
-
-
Add a dropdown field for
Day of the Week
with options:-
Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday.
-
-
Add a number field for
Day of the Month
(range: 1-31). - Add an equation field called "Current Date" and set it as
CURRENT_DATE()
Step 2: Add the Equation
Step 3: Test the Equation
-
Input various combinations of values into the fields and verify if the equation outputs
1
when the task is due today and0
otherwise.
Example Scenarios
Recurring | Frequency | Day of the Week | Day of the Month | Is Due Today |
---|---|---|---|---|
Yes | daily | NULL | NULL | 1 |
Yes | weekly | Monday | NULL | 1 (if today is Monday) |
Yes | monthly | NULL | 19 | 1 (if today is the 19th) |
No | NULL | NULL | NULL | 0 |
Conclusion
This setup ensures your tasks dynamically adapt based on the values in their records, making scheduling and tracking more efficient. If you have any questions or need further assistance, feel free to reach out to Tadabase support.
We'd love to hear your feedback.