question

FrancineN avatar image
0 Likes"
FrancineN asked FrancineN commented

How to sum label values from a list

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. ).

FlexSim 23.2.0
listsqlsum
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Joerg Vogel avatar image
1 Like"
Joerg Vogel answered FrancineN commented

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


sum-list-field.fsm (30.7 KiB)
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.