Hello everybody,
I am trying to route a item from a queue to a specific combiner(I have 3 combiners - based on values on table). My problem is that the item can only go to the specific combiner if the item has the same labels (SB and B_Type) as the combiner (SB and B_P_Type), if the item is not posible to go to the combiner, the idea will be to skip the item and check another one in the queue until find a match and route that match.
I need both checks statements to move the item. If there is no match, it will stay there and try to find the match in the queue (if the match it is not still there, I guess it will keep checking everytime a new item arrives to the queue).
I am using the code in the queue "Almacen_UA" (on another queues too but once I fix it there, I can manage for the rest)
The code is:
/**Custom Code*/ Object item = param(1); Object current = ownerobject(c); // Define the "Routes" table. Variant tableID = "Routes"; Table table = Table(tableID.as(string)); // Set the row and column of table row and column to read. Variant row = item.SB_Type; Variant col = 3; // Set Destination variable from the table. string Destination = table[row][col]; // Loop through the output ports of current for(int x=1; x <= current.outObjects.length; x++) { // Set DestTo to the object that output port x goes to. Object DestTo = current.outObjects[x]; // If they are the same, then return x (output port of processor). if(Destination == getname(DestTo)) { if (current.outObjects[x].SB_P_Type == item.SB_Type) { if (current.outObjects[x].B_P_Type == item.B_Type) { return x; } } } } }
Right now, it is sending everything no matter the label of SB_Type and B_Type (the item label) with SB_P and B_P_Type (the combiner label) -.- so I don't know what I am missing...
I hope it makes sense my problem! Any help is appreciate :D
Thanks,
Ana.