Convert result of Attempt to a list #35
-
|
I used the pyCommunicator to get some results from python. In my case, the result is a sequence, lets say I would like to assign the priority of an agent according to this sequence. Each order has an orderID (1,2,3, etc) Does anyone know how I can solve this,or how to do this in another way?? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
As described here, you need to convert the Attempt object to a Java type by passing what class you want to convert it to (and you can use the 'shortcut' described in the linked-page to do this in one call). Also, using pyCommunicator.run("sequence = [2,5,3,6,4,1]");
ArrayList<Integer> seq = pyCommunicator.runResults(ArrayList.class, "sequence");
traceln(seq.get(1)); // prints 5
traceln(seq.indexOf(5)); // prints 1 |
Beta Was this translation helpful? Give feedback.
As described here, you need to convert the Attempt object to a Java type by passing what class you want to convert it to (and you can use the 'shortcut' described in the linked-page to do this in one call).
Also, using
get(1)will return the value at index 1 (i.e., 5). If you want the reverse, you can useindexOf. For example: