Business Process Modeling - BTMSoftwareSolutions.com

Thursday, October 22, 2009

Intalio Timer - xPath Durations

This is a short blog to share my experience in creating a process which uses a parallel gateway in a potentially long ongoing process to allow users to perform work while process simultaneously calls a reporting service quarterly while that process is still in progress.  Here is how I did it:

The user form (Orbeon xForms) which kicks off the process determines the current date and using xpath sets date to either {year}-01-01T12:00:00.000, {year}-04-01T12:00:00.000,  {year}-07-01T12:00:00.000, or {year}-10-01T12:00:00.000.  If the month is 10, 11 or 12, one year is added to the current year so reporting quarter is in the correct year.

So, the process recives this dateTime value and it is mapped to a process variable called reportKickOff.  After the one parallel gateway branch a timer is placed and set to this value.  When the dateTime is reached, the process continues into a loop which first calls a reporting service and after service completes encounters another timer.  Here I take the reportKickOff value and add 3 months.  So, if it was 2009-01-01T12:00:00.000 it is now 2009-04-01T12:00:00.000.  The key here in the mapper is to take the reportingDate (of type xs:dateTime) variable and map to function op:add-yearMonthDuration-to-dateTime() and then map String "P0Y3M" of type xs:yearMonthDuration() to same function.  This is then mapped to 'date' variable in right side of mapper.

Once this date is reached, process continues into an intermediate event which resets the reportKickOff variable by adding another three months using the same technique above, the loop condition is evaluated and if condition to exit is not met, the process loops and calls the reporting service.  After the service completes, the timer is reached again and it waits until the next quarter.  This process repeats every 3 months until the loop is broken. 

To end the process, both branches of parallel gateway have to complete.  If user is done with this long ongoing process, before they reach the end of the parallel gateway I set reportKickOff variable to currentDate() and a loop variable to exit.  By setting the reportKickOff variable to currentDate(), the timer will release and the reporting loop will evaluate to exit.  Both parallel branches will now meet and the entire process can complete.  Before the process ends, I call the reporting service one last time to submit the data for the duration the process was in progress since last reporting period.

If you would like to learn more information about how you can use timers and loops like this in one of your Intalio processes - contact me at BTMSoftwareSolutions.com.