Unsubscribe   Open in Browser  

Vineyardsoft Corporation   800.850.8055   info@vineyardsoft.com    www.vineyardsoft.com 

KnowledgeSync Education Bulletin  
Leading the Way in Business Activity Monitoring


KnowledgeSync - Did you know?
How to Schedule an Event to Run on Working Days



Question:

Is there a way to schedule an event to run only on working days?
For example we want to run a query on the second working day of the month. Working days being Monday to Friday.
i.e.
If the 2nd of the month occurs on a Saturday then we want the query to run on the following Monday (4th) if the 2nd of the month occurs on a Sunday then we want the query to run on the following Tuesday (4th)

Answer:

In a previous article, we discussed how to schedule events for specific days of the month - 1st Monday, etc.
Here, we describe how to extend the concept to schedule only for working days.

If you want a query to run on the second working day of a month then it needs to run on the 2nd except when the 2nd falls on a Saturday, Sunday or Monday.
If the 2nd of the month occurs on a Saturday then we want the query to run on the following Monday (4th).
If the 2nd of the month occurs on a Sunday then we want the query to run on the following Tuesday (4th).
If the 2nd of the month occurs on a Monday then we want the query to run on the following Tuesday (3rd).

Thus the trigger to use is the date of the Next Sunday.
If the Next Sunday is 4th, 5th, 6th or 7th and current day is 2 then run (i.e. the current day of the week must be one of Tuesday through Friday)
If the Next Sunday is 9th or 10th and current day is 4 then run (i.e. the 2nd must have been on a Sat or Sun and we need to run on the Mon or Tues 4th)
If the Next Sunday is 8th and current day is 3 then run (i.e. the 2nd must have been on a Monday so need to run on the Tues 3rd)
Else don"t run.

SQL to achieve this:
AND ((RIGHT("{%Next Sunday Date YYYY/MM/DD%}",2) IN ( 04 , 05 , 06 , 07 ) AND "{%Current Day%}" = 2) OR (RIGHT("{%Next Sunday Date YYYY/MM/DD%}",2) IN ( 09 , 10 ) AND "{%Current Day%}" = 4) OR (RIGHT("{%Next Sunday Date YYYY/MM/DD%}",2) = 08 AND "{%Current Day%}" = 3))

And use the Event Schedule to process every day.

If you have any questions about any other KnowledgeSync functionality, please contact Don Farber at farber@vineyardsoft.com.

Vineyardsoft Corporation
1-800-850-8055
info@vineyardsoft.com
www.vineyardsoft.com



Video     Data Sheet     Podcasts     PowerPoint Overview     Supported Applications    

Become a Business Partner     Newsletter Archive