TerryHu 50EY7G29X8 Visits (13684)
Steps to run the sample
In the above example, the Time Schedule is called “Normal Workday”, working hour from 09:00 to 18:00 from Monday to Friday. Note that “Not include Holiday” checkbox is enabled. This is important because you want to calculate the End date across a customized holiday (Spring Festival in this case). If you uncheck this, only the weekend days (Saturday and Sunday) are considered as holiday. Note down the Time Schedule Name; iIt will be used later.
Click OK to finish the service.
In the above example, my holiday is called “Spring Festival” with 6 days (from 1/27 to 2/3). Note that you don’t need to add the weekend. Note down the holiday schedule name, it will be used later. Click OK to save the holiday.
Now there are two holidays defined in the current BPM system, as below:
In the above example, the below data is used for testing:
Work Schedule: Normal Workday
Holiday Schedule: Spring Festival
Start Time: 1/26/2016 1:55PM
Note: Because the holiday schedule defined the holiday period from 1/27 to 2/3, the first next business date will be 2/6/2017, then plus 5 work days we get 2/10 as end date.
Tips when you use the calculation
When we are testing this API, we need to pay attention to some special cases and tips.
Tip 1: The start time and end time of the work schedule cannot be the same
If we set the start time and end time the same, we may not get an expected end date. For example, if we set below:
The start time and end time are wrongly set both to 09:00. When we are doing the test, we can see the End Time is not correct:
So, please avoid setting the start time and end time as the same.
Tip 2: Match BPM system time zone to the Operating System (OS) time zone
By default, BPM is reading the configuration from 99Local.xml, which is Central Standard Time (CST) by default, as can be seen from 99Local.xml:
It is mandatory to change your BPM System time zone to match your Operating System time zone. If you don’t do this, you will get unexpected results. In my example, I am located in China and hence use UTC+8 as my time zone. I need to set below setting in 100Custom.xml:
For information on how to add the custom property in BPM, please see: Changing server properties in 100Custom.xml.
If I don’t set the above, the test result will be unexpected since a different time zone is used for calculation than the one that is used to store the date objects:
To avoid this, always make sure you set the correct BPM time-zone to match your OS time-zone.
For a full list of accepted values of <time-zone> tag, please see Table 6. Time zone information, “possible location values” column in section KPI History and Prediction widget payload format.
Tip 3: The start Time will automatically shift to the next available one if it falls into the off-shift work schedule
Sometimes, if we don’t pay attention to the start time, it may cause a problem. For example:
As shown above, if we set the start Time as 7:00PM which is outside of the defined work day schedule (9:00 – 18:00), the start time will automatically shift to the next available work day and starting work time. In this case, I have defined Spring Holiday from 1/27 to 2/3. The next available work day is 2/6 (and starting work time is 9:00). So, plus 1 day we get the End date as 2/7 9:00AM.
Similarly, the minute will also span across the time period, as below:
As we can see, adding 50 minutes after 5:45PM will get to 6:35PM. But since the work schedule defines the last work schedule time as 6:00, the rest of the time (35 minutes) will go to the next available work schedule, which is 1/9 9:00AM after the weekend, then finally becomes 1/9 9:35AM.
Some known APARs related to tw.s
JR54243: IF TW.S
JR47543: TASK DUE DATES INCORRECTLY CALCULATED FOR 24X7 WORK SCHEDULES WITH HOLIDAYS
Downloading sample process application