Bug: Execute entity transformer icm Get branches from a pattern

Hi,

I have an incoming route which sometimes gives an array and sometimes just one entity as result. In my incoming route i use a conditional transformer to determine if it’s just one or an array.

If it’s not an array the execute existing transformer performs the get branches from a pattern function with the following pattern data.entity.

If it’s an array the else execute existing transformer performs the get branches from a pattern function with the following pattern data.entity.*
When called this way the execute existing transformer throws the error: The number of entities returned by the entity transformer should be exactly one, received 2 entities

When i create a get branches from a pattern without the execute existing transformer as parent the function(NOTE: this has to be outside the conditional transformer, else i can’t select get branches from pattern) does what i expect.

Could you look into this?

Thanks in advance!
Rolf

Hi Rolf,

Thank you for posting the issue.

As you may already know that the “Execute entity transformers” (under “Data, transform data using mappers and conditions”) expects only one entity as a result of transformers inside it.

Therefore, we would suggest using “Chain entity transformer” as the root prototype of the entity transformer, such as below.

You can use “Conditional entity transformer” to do the conditional to check whether it is an array or not in this case. Then, you can put another one to check whether it is not an array.

Please give it a try and let us know if this is not the case.

Hi,

I am a colleague of Rolf, we where testing this issue together.
We managed to get this working with a somewhat other method.

But your suggestion is more solid, since then you can apply both conditions if needed.
Thank you for your feedback.

It did not occur to us that the “Execute entity transformers” could be the culprit for this since we expected all transformers to be the same as in the root (Chain multiple entity transformers).
I don’t know if it would help, but if the “Execute entity transformers” transformer limits some of the transformers executed below it, maybe the labels should be adjusted or something.
In the case of “Get branches from a pattern” it should be “Get branch from key/value” or something like that. Since “branches” and “pattern” both suggest multiple entities.

Hi Rick,

We are glad to hear that you managed to get it working your way.

You can also do one conditional to check whether it’s a single object, then convert it to an array.

Then, you can make sure that you will always have an array before facing the “Get branches from a pattern”.

Thank you for your valuable feedback regarding the name of the transformers. We will pass it on to the team for further discussion.

Feel free to let us know if you have any other feedback.