Working days calendar in WEBCON BPS

Facebooktwitterpinterestlinkedinmail
Applies to version 8.3.x; Author: Kamil Nędza

 

Working days calendar is a tool which allows you to create a calendar containing all business days in the given year – the calendar is completed by defining a list of non-working days.

A correctly configured calendar may be used to supplement the SWE Web Part and also to add some possibilities to Timeout type actions, which can then take into account working days when performing certain calculations.

Configuring the calendar:

In order to configure the working days calendar, go to System settings and from the Global parameters node select Working days calendar.

With the calendar configuration screen open, follow these steps:

  • Use the Add button to add a blank calendar for a chosen year.
  • Add your weekdays that are work-free days by default (i.e. weekends, e.g. Saturday, Sunday)
  • Define a list of all other non-working days relevant to your company/region, like national holidays
  • Save

1

 

Example 1 – Timeout:

In order to employ the calendar in actions triggered by Timeout, toggle on the option to Ignore days off – this will make the timeout action only count working days for various calculations. It is possible to either ignore only weekends, or all non-working days defined in the working days calendar.

2

 

Example 2 – SWE display:

When the calendar is correctly defined, in the SWE Web Part configuration options we have access to  extra columns, one which tallies up the number of business days an element has been in the current step, and one which tracks the duration of a step in business days. They can be found in the SWE configuration under Data presentation and searching.

 

3

 

Example 3 – Creating custom SQL functions:

For every individual non-working day added to the Working days calendar, an entry will be created in the Calendars table of the BPS Content database.

4

 

Based on this table in the database, we are able to create a simple function which will use the entered date (preferably in text form, so it can support BPS tags) and an entered number of working days as parameters – and will then return the date of a working day, which will occur after the entered number of working days pass from the entered date:

create function CALENDAR_ReturnWorkDay (@Date varchar(11), @NumberOfDays int)
RETURNS datetime AS
BEGIN
DECLARE @result datetime

set @result = (select top 1 CAL_WorkingDate from (select top (@NumberOfDays) 
CAL_WorkingDate from Calendars where CAL_IsWorkingDay = 1 and CONVERT(date, 
CAL_WorkingDate, 121) > (convert(date, @date, 121)) order by CAL_WorkingDate ) as 
WorkingDays order by CAL_WorkingDate desc)

return @result
END

Keep in mind that if the entered number of working days (the number of working days that must pass from the entered date) is 0, the function will return nothing.

The function should look something like this:

5

 

This function can be easily used in any process configuration, replacing the entered date with a BPS tag that references a date form field in the workflow.

Leave a Reply

Your email address will not be published. Required fields are marked *