Coercions in TIBCO BW

There is some aspects in the BusinessWorks that is importat to be aware of. One of them is the coercions in our developments. Coercion is the TIBCO name for one of the most common procedures in programming, a ‘Class cast’ or more exactly a ‘down class cast’. So the explanation is very simple. We have one input value that is a any value, and we don’t want o we don’t need to know the value of this any to do our duty, but so far we continue in the processing we need to do the exact composite of this element, so we can perform this task to use the inner elements.

Take a look how coertion looks in TIBCO BW. First we define a element as a Any type, as we can see:

COERTION_1

 

But in some activity we need to do a ‘coertion’ to a known schema, as we can see here:

COERTION_2

 

Be aware of the yellow bubble in the root element, that’s the sign you have, to determinate that a coertion has been made. So, for now on we can use all the inner elements of the ‘previous any element’. To perform a coertion we only have to click in the left button we can see in the Process Data section:

COERTION_3

 

And we have to fill a easy form to complete the coertion as we can see here:

COERTION_3

 

That’s all what you need to do a coertion. But we are going to talk a little more about it. So, what is the efect if we use a ‘not-allowed’ element to go through a coertion? Ok, let’s do a little test:

COERTION_3

 

We have this little process with a coertion, but we are going to do a test with another element structure, as we can see here:

COERTION_3

 

As we can start the test, there is no error in the process, but there no work doing the mapper that applies the coertion:

COERTION_3

 

But, if there is a extendable schema the work is the same? Ok, let’s take a look:

COERTION_3

 

Now, we have the three elements present in the coertion and another three. But the result is the same, no error but no coertion.

If you want to take a deeper look to the test, you have here the BW Project: Download!.

I hope you can use these information in your new developments! See you in the next post!

Advertisements

4 thoughts on “Coercions in TIBCO BW

  1. Hi, I meet error below when supply input data to starter:
    Element “root”: no declaration for element “root”

      • Hi cloud,

        The problem is that you are invoking the subprocess directly instead of using the Test process that the project provides. If you call the subprocess directlye there is some validations that the TIBCO Designer does and it doesn’t allow you to invoke the process. Please, use the Process test and modify them as you need to do your custom tests!!

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