Although TIBCO ActiveMatrix BusinessWorks™ is only compliant with Xpath 1.0 some of the Xpath 2.0 functions are surprisingly supported. The Xpath Formula Builder and the validator will however not recognize them complaining about mapping errors. These can be safely ignored since the functions will work in both design- and runtime and will not cause any issue’s.
In this example we will be calculating the number of days between two dates.
Using the Xpath function days-from-duration we can easily extract the days from either a normalized xs:duration value or delta between two dates. Note that this function does not round the number of days, so 1 days and 23 hours returns an integer of 1, but this is not relevant for this example since we will be using two date strings.
Use the following code in the XPath Formula Builder:
days-from-duration($date1 – $date2)
This function will result in an integer representing the difference in days between $date1 and $date2. This way we can create a very smart and compact solution for this challenge (try it using with the standard recognized functions!).