Tuesday, May 04, 2010

How to count the number of nodes in an array in BPEL

You have designed a BPEL process which takes an array of input.Now you want to count the number of nodes in the array to do further processing of your Business process.

We will use here the BPEL process that we have developed in our previous exercise.

First of all create a variable "count" of type integer to hold the value of the number of count for the list of array elements.

Now just drag and drop an assign activity in BPEL process and create a copy operation.

Now in the source of copy operation choose Expression and then in the expression builder just double click on the array variable.It will come automatically on the top window box,now just add ora:countNodes and include the expression within () as can be seen in the screen shots.



Say apply and ok and
Now assign this to the count variable that we have created earlier.




Once done save the changes and deploy your bpel process.

Now go to the Bpel console and invoke it with some inputs.



For testing i m using four variable as an array of input.

Now if you will see the flow the you will find that the count is showing a value of 4

No comments: