Different behavior format-dateTime between BW5 and BW6

When you are moving from TIBCO BW 5 to TIBCO BW 6 you probably have found everything in the same place. Of course, there are a lot of changes regarding the architecture and the base of both of the versions, but if you are “only a developer” you probably have find the same activities and the same tools you need to create your process. But, you have to be aware of a few things, and one of them is the one I’m going to explain to you right now:

– There are functions that are not working the same they did on previous version?

– Whaaaaaat?

– That’s impossible! If they things are not working like they were I’m not be sure if what I am creating is going to work!!!

Ok, ok, Keep calm! Don’t get there yet!! That’s only some of the functions we have in our XPath toolbox are not working as expected and one of them is format-dateTime.

You probably are used to use format-dateTime to give format to the fields with dateTime based. Ok, so, here is the trick:

If you print “tib:format-dateTime(“yyyyMMddHHmmss”,current-dateTime())” in  TIBCO BW 5.x, you will see an output like this: 20160218223308.

designer_2016-02-18_22-33-36

But if you try to use the same string in TIBCO  BW6.x like format-dateTime(current-dateTime(), “yyyyMMddHHmmss”) (you have to change the order of the arguments, because now the function receives the dateTime as it first parameter) , it will print “yyyyMMddHHmmss” and not throw an error.

TIBCOBusinessStudio_2016-02-18_22-39-30

So, what’s happening here??? Ok, it is simple. TIBCO BW 6.X uses an standard XPath and XSLT 2.0 but the TIBCO BW 5 uses a own style XPath to say on a polite way Smile. And if we read the XPath 2.0 standard documentation: Read it here we found that the standard way to do the same thing that we were doing on TIBCO BW 5 is using the following “picture string” (picture is the name the XSLT standard gives to the pattern to print the date):

format-dateTime(current-dateTime(), “[Y0001][M01][D01][H01][m01][s01]”)

If we do the change on our TIBCO BW 6 process, now we get the expected output:

TIBCOBusinessStudio_2016-02-18_22-45-37

Advertisements

One thought on “Different behavior format-dateTime between BW5 and BW6

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s