Date comparison is a common requirement when working with Oracle Integration Cloud (OIC). However, users often encounter challenges and errors while attempting to compare date values within OIC. I
The Problem:
Developers face issues when comparing two date values within a conditional statement in OIC.
Example To compare dates in different formats. we have two values ExpectedReceiptDate and ProjectEndDate in different date format .
ExpectedReceiptDate : 2024-07-07T07:20:44Z
ProjectEndDate : “2024-06-30”
Here if ExpectedReceiptDate and ProjectEndDate has to be compared in xsl it will not do the comparison and if using in a switch statement, it will go to otherwise block.
The reason it being in string format. You need to change to date format.
Even if you use xp20:format-dateTime and fn:current-date functions, all of them fail without generating any error messages.
So in this case first format ExpectedReceiptDate to desired format like “[Y0001]-[M01]-[D01]
Use substring function to get the string before letter ‘T’ in (2024-07-07T07:20:44Z) and you should get “2024-07-07” and then convert to date using date conversion function and then compare to ProjectEndDate . the ProjectEndate “2024-06-30” also needs to be converted using Date conversion.
Use the comparison as below. You can use the conversion functions for date and dateTime based on your requirement.
See different date formats here
>
ns49:date($getProjEndDate/ns0:executeResponse/ns46:response-wrapper/ns46:items/ns46:ProjectEndDate)
Date Comparison in OIC can be done in the switch activity as per image above.
See also : Data Stitch and set global variable in Oracle OIC