I have a token for each warehouse order. I need to get the total quantity per order, so I need to sum up the array token.Qty. How do I create a label that sums the array for example token.OrderQty = 11
I have a token for each warehouse order. I need to get the total quantity per order, so I need to sum up the array token.Qty. How do I create a label that sums the array for example token.OrderQty = 11
You could copy this and paste it into the Code Editor for the Value field on an Assign Labels activity:
Array theArray = token.Qty; double aggregate; for(int i = 1; i <= theArray.length; i++) aggregate += theArray[i]; return aggregate;
By a table query over the array length with a SUM clause
Array qty = [12,1.23,3.56]; double sum = Table.query("SELECT SUM($2) FROM $1", /*$1*/ qty.length, /*$2*/ qty[$iter(1)] )[1][1]; print(sum);
12 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved