The Pull From List trigger option seems to be pretty broken. I tried to use it on a Conveyor Decision Point:
Conveyor.DecisionPoint current = param(1); Object item = param(2); Conveyor conveyor = param(3); Conveyor.Item conveyorItem = conveyor.itemData[item]; { //************* PickOption Start *************\\ /***popup:TriggerPullFromList*/ /***tag:description*//**Pull From List1*/ if (/** \nCondition: *//***tag:condition*//**/true/**/) { int callbackCase = param(6); #define CALLBACK_CASE 10293 int numRequired = /** \nRequire: *//***tag:requireNum*//**/1/**/; if (callbackCase != CALLBACK_CASE) { string listName = /** \nList: *//***tag:listName*//**/"List1"/**/; List list = List(listName); Variant partitionId = /** \nPartition ID: *//***tag:partitionId*//**/0/**/; treenode puller = /** \nPuller: *//***tag:puller*//**/item/**/; Array pulledArray = list.pull( /** \nQuery: *//***tag:query*//**/""/**/, /** \nRequest: *//***tag:requestNum*//**/1/**/, numRequired, puller, partitionId, /** \nFlags: *//***tag:flags*//**/0/**/); int numPulled = pulledArray.length; for (int i = 1; i <= numPulled; i++) nodefunction(c, current, item, conveyor, pulledArray[i], i, CALLBACK_CASE); if (numPulled < numRequired) { Array backOrders = list.backOrders(partitionId); List.BackOrder backOrder = findmatch(backOrders.length, backOrders[count].as(List.BackOrder).puller == puller, backOrders[count], 1); if (objectexists(backOrder)) eventlisten(backOrder, "OnFulfill", c, 0, current, item, conveyor, LIST_ON_FULFILL_VALUE, LIST_ON_FULFILL_TOTAL_FULFILLED, CALLBACK_CASE); } } else { current = param(1); item = param(2); conveyor = param(3); Variant pulled = param(4); int numFulfilled = param(5); /** \nOn Pulled: */ /***tag:onPulled*//**//**/ return 0; } } } //******* PickOption End *******\\
There are several problems with this code:
- By default line 16 reads
string listName = /** \nList: *//***tag:listName*//**/ListName/**/;
This gives a compiler error because ListName without quotes is not a string. - Line 32
Array backOrders = list.backOrders(partitionId)
gives an error because the list backorders requires a .toArray(). - Line 34: if(objectexists(backOrder)) makes no sense to the compiler. I guessed it should just be if(backOrder).
- The problem I didn't figure out yet: what to put in eventlisten as first argument?! It seems to require an Object but List.BackOrder is not an object... so what do we listen for?
Of course fixing this in a next release is great, but for now I would appreciate it if you could give me the code that should have been there, as this option would really help out a customer with a specific problem they are having right now.
Thanks!