WEEKDAY function

Hi,
Is there any form of a ‘WEEKDAY’ function with backendless UI?
I’m allowing app users to schedule tasks, one scenario needed is ‘first {Monday} of a month’.
Regards,
Paul

Hello @Paul_HIllen ,

You can use timers to solve this tasks. However, if this is not what you meant, please describe your question in more detail.

Regards,
Nazar

Hi Nazar,
Thanks for the reply.
I want users to define their own day when tasks are to be done. They will not have access to the console to define a timer.
We are offering various timings such as ‘every month on the 28th’, ‘every Monday’, ‘First Monday of the month’
Is there any UI Blocks to allow api access to ‘Timer’ logic creation?
Or is there any functions which would mimic ‘WEEKDAY’ function used in Excel etc.
Regards,
Paul

Hi Paul,

I would apply the following design to implement what you described:

  1. Let your users create any timing you need
  2. When a task from a user is being saved, create a schedule for it, i.e. calculate all the dates and times when it needs to run.
  3. The result of (3) would be a collection of records (tasks). Each task would have a specific date/time when it needs to run.
  4. Create a timer that wakes up every hour (24x7x365)
  5. When the timer wakes up, it retrieves all the tasks for the past hour that need to be executed
  6. Execute the tasks.

This way you will be combining the functionality of the timers in Cloud Code and the flexibility of your scheduling design that you want to provide to the users.

Hope this helps.

Mark

Hi Mark,
Thank you for the help. It helped firm up my approach.
Currently, I’m investigating point no. 2 from your list - i.e. calculate all the dates…
As you messaged, I looked at your ‘Custom Code’ post and how to import an NPM module.
I want to import a module which would allow me to find them, for example, ‘the first Monday of the month’ etc., and from there, I will have the specific dates and times.
All the best,
Paul