Hi, in order to calculate daily inventory on hand, I use a schedule source activity and a custom code. The schedule source used for making sure that there is a token per day to request the calculation via the custom code.
However, after running the simulation until 100 time unit (days), there were around 116 data, meanwhile I was expecting only 100 data (because the simulation run for only 100 days)
Attached is my code. Any idea what is wrong with the code?
Thanks
Object current = param(1); treenode activity = param(2); Token token = param(3); treenode processFlow = ownerobject(activity); { //************* PickOption Start *************\\ /***popup:AddRowToGlobalTableNew:config=ProcessFlow*/ /**Add Row and Data to GlobalTable*/ /** \nAs each flowitem enters, add a new row to a GlobalTable and write data to that row.*/ Variant tableID = /** \nTable: *//***tag:table*//**/"DailyInvLevel"/**/; int columns = /** \nNumber of Columns: *//***tag:col_ct*//**/1/**/; Table table; switch (tableID.type) { case VAR_TYPE_NODE: table = tableID; break; case VAR_TYPE_STRING: table = Table(tableID.as(string)); break; default: table = reftable(tableID.as(int)); break; } double rows = table.numRows + 1; table.setSize(rows, maxof(columns, table.numCols)); table.setColHeader(1,"OnHand"); /** \nCommands to set the data in the new row:*/ int i = 1; /***tagex:data_values*//** \n */table[rows][i] = /** */getstat(getactivity(current, "List: DC"), "Content", STAT_CURRENT, current);/**//**/; i++; /***/ } //******* PickOption End *******\\