Multi instance doesn't return value

Hello,

I have a diagram with a multi-instance.
The output collection is results.

If the multi-instance has “output propagation” set to false, the results variable becomes an array of null.
However, the strange thing is that if I set “output propagation” to false and define any output mapping, the results variable is returned correctly.

When I set “output propagation” to true, everything works as expected.

Is this the expected behavior, or is it a bug?
Thank you!

Agostino

Hi @tavolate,

the ‘output propagation’ field is from the ‘Call activity’.
With this you can return all the variables to the parent scope.

The ‘Output collection’ is from the ‘Multi instance activity’.

When you disable output propagation (and no custom mappings explicitly defined) from the Call activity but you still have the output collection, then you get a nulled list as defined as output colelction.

When you disable output propagation (it just means no default mapping from all fields) but you specify explicit mappings, then you get the explicit results.

Output propagation set to true results in default mapping of all attributes to the higher scope. Those will be mapped into you output collection.

You should see it as 2 different steps.
The call activity is scoped inside the multi instance.

1 Like

Thank you, it’s clearer now. However, I still don’t understand why disabling output mapping and defining an explicit mapping (with a name different from the ‘output element’) causes the output collection to be returned correctly

What do you mean by ‘returned correctly’?
I’m not sure if i understand you 100%.

Disabled output mapping means that the Call activity does not dump all attributes. by default. It can still be mapped manually.

The Multi instance activity now gets the output from each iteration that you can map into the output element (output element is just a map for the current iteration).

The output collection is a list of your output elements from each multi iteration.

As you can see in the screenshot, I disabled output propagation and defined a fake mapping. In this example, the output collection contains all values (not null)

How does the output Mapping look in the called element?
The dummy variable is not connected to the output element and the fake value is not a string but a feel expression. Should it be a variable key or a string value?

Can you try to make a output mapping like
Process variable name: result.myFakeValue
variable assignment value := ‘fake’

@tavolate I think @OwndbyFab is suggesting that for you to understand how the pieces fit together, you break the joined element down into simpler equivalents.

The two elements in this image are functionally equivalent. If you convert your MI Call Element (top item) into the MI with a Call Element in it (bottom item), you might be able to understand how the pieces fit together better.

Equivilent-Steps

1 Like

Ok, I understand. However, it’s strange that when I define a fake mapping (as shown in my screenshot), the output collection is propagated correctly.

Your fake mapping does not write to the output element.
And how is the end element of the banale process configured?
Does that process have an output mapping that is maybe merged into your parent process?

The banale process simply adds a variable named result, but no mapping is applied to the final element of the subprocess.