Hello all
Multi-instance call activity where each child process returns a value
How can I collect the return value from each child process? I came across an old thread
but I can use some help.
Hello all
Multi-instance call activity where each child process returns a value
How can I collect the return value from each child process? I came across an old thread
but I can use some help.
Hi,
Use multiinstance variable agregation.
Code snippet from the test
<multiInstanceLoopCharacteristics isSequential="false">
<extensionElements>
<flowable:variableAggregation target="reviews" createOverviewVariable="true">
<variable sourceExpression="${task:get(taskId).assignee}" target="userId" />
<variable source="approved" />
<variable source="description" />
</flowable:variableAggregation>
</extensionElements>
<loopCardinality>${nrOfLoops}</loopCardinality>
</multiInstanceLoopCharacteristics>
Regards
Martin
Martin,
Thank you for taking the time. I would like to ask a followup.
Is it possible to have 1 aggregated and 1 non-aggregated variable?
In the below snippet, status is an aggregated attribute but respCode is not.
<callActivity id="getOrderStatus" name="Get Order Status" calledElement="orderStatusChildProcess" flowable:calledElementType="key" flowable:fallbackToDefaultTenant="false">
<extensionElements>
<flowable:in source="order" target="order"></flowable:in>
<flowable:out source="status" target="status"></flowable:out>
<flowable:out source="respCode" target="respCode"></flowable:out>
</extensionElements>
<multiInstanceLoopCharacteristics isSequential="false" flowable:collection="orders" flowable:elementVariable="order">
<extensionElements>
<flowable:variableAggregation target="status">
<variable source="status" target="status"></variable>
</flowable:variableAggregation>
</extensionElements>
<loopCardinality>${orders.size()}</loopCardinality>
<completionCondition>${nrOfCompletedInstances == orders.size()}</completionCondition>
</multiInstanceLoopCharacteristics>
</callActivity>
I find that the non-aggregated variable is null.
Hi,
Could you provide any example how it could work?
How I understand the usecase:
There are n call activities and one aggregated output variable. Each call has one output variable, which is not aggregated.
What should be the value of the variable when all required multiinstance executions are done?
Regards
Martin
My use case is almost the same as the document review example that are shown in the multi-instance related blogs and demo videos. It appears that I had an incorrect understanding that you could have a combination of aggregated and unaggregated flowable:out variables. In my defense, docs didn’t tell me that I couldn’t.