Hi,
I have a multi-instance task/call activity which I want to run over a hashmap which is of {integer, list}.
Does the loop cardinality accept the hashmap?
Thanks!
Hi,
I have a multi-instance task/call activity which I want to run over a hashmap which is of {integer, list}.
Does the loop cardinality accept the hashmap?
Thanks!
Create a array (collection) of objects where each object is a key value pair. Same idea if it was a Json array of objects
Thanks @StephenOTT,
I understand it’s JAVA knowledge, but does this mean I have to create a POJO first?
Having one Integer property and one of list?
You should be able to do it with a small script or even possibly with expression. But at worst just create a input variable that is a script that converts from tour hashmap into a array of objects (can likely use a little stream in a groovy script for a one line script). Then use that variable as your collection value in the multi instance
@StephenOTT, any example of such a script?
Does the collection field accept entrySet?
If i write sth like
myhashmap.entrySet();
is it acceptable?
Does the java version I use play a role?
I use jdk8.
Thanks a lot!
It needs to be a java Collection. So anything that returns the collection interface type.
Look at this example https://stackoverflow.com/a/34176721 and just ignore to conversion to json part
I wrote a groovy script:
def newmap = mymap.collect([] as ArrayList) { key, value -> [key, value]};
(the collectEntries
from the example converts by default to a LinkedHashmap (and I don’t know how to change it), which was not accepted as a java collection in the multi-instance, so I used the .collect()
)
Seemed to work