How to sum label values from a list

How to sum label values from a list

FrancineN
Not applicable
288 Views
5 Replies
Message 1 of 6

How to sum label values from a list

FrancineN
Not applicable

[ FlexSim 23.2.0 ]

I am pushing tokens that contain the label "smallItemQty" with a numeric value to a list.

I want to pull from the list 1 token with the sum of the value of all tokens with that, resulting in 1 token labeled "totalSmallItemQty".

I tried "select SUM (token.smallItemQty) AS totalSmallItemQty" as a query but wth no luck.

I also tried adding the values with setting a variable and using statistical collection but I could not get that to work either plus it's not my preferred option since I want to do additional things with the summed value using the token label value.

I did not try a loop yet since I figured a simple SUM query in a pull should do the trick (The pushed values will be coming in at a specific moment and not continuously. ).

0 Likes
Accepted solutions (1)
289 Views
5 Replies
Replies (5)
Message 2 of 6

joerg_vogel_HsH
Mentor
Mentor

SELECT SUM(fieldname of list) should do it. Activate on general tab: Assign SELECT Values to Puller Labels.

Try Use First SELECT value as Quantifier

Try also Track Number Field Totals.

From: https://docs.flexsim.com/en/23.1/Reference/Tools/GlobalLists/General/General.html

clauses in a query are typical in upper case characters.

0 Likes
Message 3 of 6

FrancineN
Not applicable

Thanks for your reply. I checked the options suggested but I could not get it to work unfortunately.

Some screenshots, of my list and my pull request. I also attached the model.

The pull result I am aiming to get is "7"


The error I am receiving when it want to pull:

exception: Exception caught in start() of activity Check for full pallet pick/Pull from List in process flow "ProcessFlow". Continuing throw...

exception: Exception caught in Executive::processeventinlist().


Thanks in advance for any help you can offer.


FullPalletPick.fsm


1714683973613.png

1714684126728.png


0 Likes
Message 4 of 6

joerg_vogel_HsH
Mentor
Mentor
Accepted solution

I got to run as a table query in a source code:Sum_List_field.fsm

Message 5 of 6

moehlmann_fe
Enthusiast
Enthusiast

Note that this only works for a global list. The only way I've found to get the sum from an internal list is to pull all values with the select clause and then add together the entries of the resulting array.

sum-list-field_1.fsm

0 Likes
Message 6 of 6

FrancineN
Not applicable

Adding together the array values did the trick, thank you both for your help!

0 Likes