MultiInstanceTask - defined "Input" available for "Collection" definition? how to Input parameters


#1

Hello,

I just want to iterate with a MultiInstanceTask 2 times over a fixed list collection of “bla”, “foo”.

  • I tried to define something direct in Collection (multiInstanceLoopCharacteristics camunda:collection ) like this: "bla","foo" and ["bla","foo"].
    But I always got didn't resolve to type 'Collection'

  • Than I tried to define a list as input parameter and access the variable but always got:
    ENGINE-02025 Variable 'MyList' is not from type 'Collection'.

      <bpmn:subProcess id="EUAPANodeApprovalTask" name="sequenziell je EUAPA-Knoten">
        <bpmn:extensionElements>
          <camunda:inputOutput>
            <camunda:inputParameter name="MyList">
              <camunda:list>
                <camunda:value>bla</camunda:value>
                <camunda:value>foo</camunda:value>
              </camunda:list>
            </camunda:inputParameter>
          </camunda:inputOutput>
        </bpmn:extensionElements>
        <bpmn:incoming>SequenceFlow_1i3k00t</bpmn:incoming>
        <bpmn:outgoing>SequenceFlow_0n1qhc1</bpmn:outgoing>
        <bpmn:multiInstanceLoopCharacteristics isSequential="true" camunda:collection="${MyList}" camunda:elementVariable="nodeType" />
    

So you see my mistake or what is the easiest way to give Multi Instance Collection a fixed string list?


Is it not possible to assign values in multi-instance activity
#2

Hi timguy

I would try to use the loop cardinality instead of Collection, either by defining a static value (2 in your example) if it always will be 2 or by ${yourArrayProcessVariable.length} respectively ${yourListProcessVariable.size()}.

If it is important that you know, what is the value (bla or foo) of the active instance you can use the loopCounter Process Variable, which is generated by the process engine (it is like the iterator in a classic for-Loop).

Not sure, if this is the most elegant solution, but it should work (not tested).

Kind regards
Björn


#3

Hello Björn,

thanks, well this is an idea. But I need the value of the list but at least the number is fixed. Well I could read the loop count and than map the count to my string. Feels very ugly.
I think I will set a process variable somewhere in my java code before via some listener. Feels also wrong because the string list is always the same.

I hoped somewhen will tell me - just add some curly and square brackets in the modeler and you are done.

Maybe others have an idea how to directly add a fixed string collection?


#4

hi. have you found a solution yet? i have the same requirement.


#6

@Urvashi_Prasad

I would not call it a solution just a workaround.
In my start event I have a listener and than I set a process variable with my collection. It’s a collection of java enums and later I can access them in the multi task.

The other workarounds with a fixed counter and than count yourself up every loop should work as well.