Process Scheduler
The Process Scheduler component demonstrates how to set up a component to use the SCHED LibraryPreview to schedule a batch process.
Running the Component
Using +COMPONENT, import the Process Scheduler component
Tip: since the SCHED function runs a check on the time every time the component polls, a smaller polling time means the batch process will likely start closer to your scheduled time!
On startup, the component will run the batch process once to initialize the last run time. It will then only run the batch process at the scheduled hour every day. It will also display the last run time and next scheduled run time in the component card:
The SCHED library enables scheduling on a daily, weekly, or monthly basis:
Daily (simple format)
-- Example 1: Daily at 11:30 AM (backward compatible - original v6 format)
SCHEDrunAt(11.5, DoBatchProcess, "Some Argument", "Second Argument", "etc...")Daily (table format)
-- Example 2: Daily at 11:30 AM (table format)
SCHEDrunAt({type="daily", hour=11.5}, DoBatchProcess, "Some Argument", "Second Argument", "etc...")Weekly
-- Example 3: Weekly - Every Monday at 9 AM
SCHEDrunAt({type="weekly", weekday=2, hour=9}, DoBatchProcess, "Some Argument", "Second Argument", "etc...")Monthly
-- Example 4: Monthly - First Monday of the month at 9 AM
SCHEDrunAt({type="monthly", weekday=2, occurrence=1, hour=9}, DoBatchProcess,"Some Argument", "Second Argument", "etc...")In the event the scheduled day doesn’t exist in the month (e.g. the 4th Monday would be the 29th of February), the library will rollover to the next month (4th Monday of March).