Friday, January 20, 2012

BPEL - Handle variables in a 'Assign'

Recently, I worked on a project and used array to save all of exceptions catched in a loop. I set the value to the array used a variable as index, but it doesn't work. I tested it with a number directly, it works well. By the colleague help, I eventually fixed this issue and make the array work with a variable as index.

The tricky thing is the table on the edit assign supports right click and can pop up a menu. The menu is the magic.


From the menu, select the insertMissingToData, then the array setting will work.
The change to the element is
<copy bpelx:insertMissingToData="yes">

This is not the only tricky thing as it is not only apply to the variable in an array, for any variable is same if the XML document is not initialized by some operation already. You have to set insertMissingToData="yes".

Another tricky thing is the generated XML. The order of XML elements is related with the order of assigning.

1 comment:

Alejandro Donate said...

Thanks for this trick, I been working on my issue for hours. In my case I was trying to get the value from an array and put it into an array: this is how I did it using the ArraySample.bpel