Ability to choose task by days of week

Those who have used the Task feature know that currently users ONLY has the ability to choose “daily, weekly or monthly” to preform task. I would like to know if there is a work around (code) that gives the ability to choose the days of the week to perform a task (Mon, Tues etc…) or even weekdays or weekends.

Currently we have a task that turns on a certain feature for our customers during working hours. “On” @ 8am, “Off” @ 5pm. Works pretty good. The problem is, we are closed on the weekends and because there is no weekend selection in the task setup just daily, the feature for our customers is ON during the weekend hours of 8-5. If one of our employees or myself remember, we log into the builder side of Knack and manually turn feature OFF. We must perform this manual override for both days of the weekend (SAT/SUN).

Any and all solutions is appreciated… JON

Hi @Jon1,

would a condition excluding certain weekdays calculated with the function “getDateDayofWeek” solve your problem?

Run Task when

1 Like

Hey Wolfang, it’s worth a shot… Do you mind helping me set the perimeters of the function?

I would like to have the task “ON” M-F and OFF (Sat/Sun).

Thanks again for the quick response and possible solution… JON

@Jon1 - @Wolfgang_Brötz is right and we use this a lot to run tasks during the week and not weekends.

@Wolfgang_Brötz not sure how you’ve been able to insert the formula into the ‘When’ criteria for a task as we can can only select existing fields?

So for us:

  1. Create a text formula field to store the current day - getDateDayOfWeekName(currentTime())
  2. Create a task and use the CurrentDay #1 field in your filters to exclude or include the days you want.

The function is described here Knack builder guide > Text formula functions > Date functions and you’d need to filter out days that contain Saturday or Sunday.

Hi @BradStevens,

i renamed the field to make the screenshot easier to understand. This felds calculates the weekday and tests it, e.g. “is the weekday of this date a weekend?”

@BradStevens, thank you for your assistance.

When creating a equation field I choose “numeric” as the equation type, with no other options selected.

I’m assuming the current day of week (Sunday) is “1” and Saturday is “7”.

If the above is correct, task was set to run when CurrentDay is not 1 and CurrentDay is not 7.

Thank you… JON