Date Comparison in OIC: Oracle

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.

The tip is that even if the two values are of date data type the format has to be same.

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(fn:substring-before(/ns19:onEvent/inp1:findShipmentResponse/inp1:result/ns22:ExpectedReceiptDate, โ€˜Tโ€™))
>
ns49:date($getProjEndDate/ns0:executeResponse/ns46:response-wrapper/ns46:items/ns46:ProjectEndDate)
image date comparison in oic 1

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

More on OIC

wpsbutton
We will be happy to hear your thoughts

Leave a reply

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
Best Wordpress Adblock Detecting Plugin | CHP Adblock
Cloud Technologies Blog
Logo
Compare items
  • Total (0)
Compare
0
Shopping cart