using Arrays and Dynamic subprocesses in iProcess

07 Oct

Last week I had a case where the requirement was to start a iProcess case from BusinessWorks. This is not new, but there were a few additional requirements:

  • The iProcess case would be started with 1-n codes mapped by BW
  • For each code in the main procedure, we needed to parallel start a subprocedure which would handle the BPM flow including complex business rules (iDecisions), conditions and forms.
First step is to define a array named CODES in the procedure. Then the challenge is to send the Array from BusinessWorks to iProcess. Normally objects are send as Fields to a case using a certain FieldType like swDate or swText. Due to enumeration you can see that a valid FieldType is “swArrayOfText” but documantion is not clear how to use a valid format (bracket, pipe, etc) to fill this fields value (as more developers have discovered)
The answer is as always very simple, when you know it. ;)
iProcess handles an swArrayOfText as a set of Text fields with an index. So the proper usage is not to try to send 1 Field with the whole Array but to construct a Field for each array item like CODES[1], CODES[2], etc. So we need to map them individually from BusinessWorks.
The BW mapping in the example below shows a For-Each mapping on the set Fields which does the trick.
In the iProcess procedure we now have our Array so we can now try to start a subprocedure for each item. Since we want to start the subprocedures parallel and not serial we can not use a “normal” LOOP and subprocedure definition.
The solution is a dynamic subprocedure defintion, however this mechanism works a bit different then the normal subprocedure definition. Big difference is that it needs an array of procedure names it will call and a template of input/output parameters. Since we will always call the same subprocedure this is somewhat odd in our case, but the only way to trigger parallel callouts. So first create a new array called SUBPROC. Then we need a script to fill the SUBPROC array with the amount of CODES in the CODES array.
  SUBPROC[IDX_CODES] := "MySubProcedureName"
The dynamic subprocedure definition is configured with the SUBPROC array.
In the input mapping to the subprocedure we need to pass the correct CODE to each subprocedure call. So we use a private-script in the mapping.

Voila, this should do the trick.

Leave a comment

Posted by on 07-10-2010 in BusinessWorks, iProcess, Tibco


Tags: , ,

Leave a Reply

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

You are commenting using your 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

%d bloggers like this: