Hello everyone
I encountered a problem when I was trying to change the order of items in a queue based on a label value. Any time an item with label "label" = 5 enters, it should be processed before any other item in the queue. I wrote the code below for the OnEntry trigger.
Now, the code results in the outputport being opened before the items are shuffled. Hence, the item initially at rank 1, so before the entry trigger, is passed to the processor, not the one I want. Only after the wrong item was passed, the remaining items are ordered correctly.
Is there an easy way to overcome the apparent delay on the item sorting step, or am I doing something wrong?
Many thanks in advance
Object item = param(1); Object current = ownerobject(c); int port = param(2); { // ************* PickOption Start ************* // if (item.label == 5) { treenode itemConsidered = current.subnodes[current.subnodes.length]; itemConsidered.rank = 1; openoutput(current); } } // ******* PickOption End ******* //