All product information in wiki.bizagi.com is only valid for Bizagi BPM Suite 9.1.X.
For newer Bizagi BPM Suite versions (10.X and up) please visit the User Guide.
 

How to Add Dates

From Business Process Management, BPM and Workflow Automation Wiki | BizAgi BPMS

Jump to: navigation, search

<keywords content="keywords">add dates, sum dates, date operation, date rule, add time</keywords>

How to Add Dates (applies to .NET Edition)

A process may require to add time to existing dates to calculate a new date. For example, in the following case, in an activity Approve Request a user selects from a drop down list when the case is expected to be solved. There are 3 possibilities:


Image:BizagiWiki_Bullet002.gif As soon as possible: 1 hour to solve the case

Image:BizagiWiki_Bullet002.gif Fast: 5 hours to solve the case 

Image:BizagiWiki_Bullet002.gif Normal Pace: 48 hours (2 days) to solve the case


According to the choices in the activity Approve Request, a Solution Date has to be presented in the next activity Complete Request. The new Solution Date has to be calculated by adding to today's date and time the number of hours indicated by the previous user. This is how the activities will look:



To achieve the previous objective follow these steps:


1. Create a new rule. follow the procedure in steps 1 and 2 in Compare Dates in the Make Date Time operations in Business Rules


2. Right click on Image:HowToSendANotification_Image011.jpg and then click on Variable Declaration




Declare the variables as shown below.



To get to the number of hours shown above it is necessary to follow the structure of the data model as shown in the example below:


The Service Agreements table is where the number of hours that have to be added to today's date are configured, as shown here:



3. Right click on the black arrow and select Add Expression.



Give a meaningful name to the expression:


Double click on the Expression created.

Call the variable just created. Use the Options button, as shown below to prevent errors when entering the variable.



Include the following expression.


This expression will add the number of hours required by the previous user to a variable that contained today's date and time. It then assigns the new date and time to the attribute dSolutionDate. The calculated date will be displayed to the user.


4. In Bizagi Studio go to : Applications and Check Out the process being used. Rght click on the activity where the new rule is to be executed (in this case Approve Request) and select Properties, select the Actions tab and add the rule.



Note that the type of rule is On Exit because it is to be executed after the activity is finished so the value of number of hours requested to solve the case is already determined by the user.


5. Now the rule can be tested. The activity Approve Request will look like this, and below is the drop down list where the user must select the time expected to be solved.



In this test the user selected Fast (5hours), and it can be seen that the solution date called Solved by has been calculated by adding 5 hours (from 7:23 to 12:23).



Related topics

How to Compare Dates

How to Subtract Dates

How to Assign Today's Date

How to Calculate Age


Go back to the Date-Time Operations Menu <comments />