question

dougdurbin avatar image
0 Likes"
dougdurbin asked dougdurbin commented

Sum label value by item type in process flow for dashboard

In my process flow I have an activity that I want to get a metric on. As the token flows through the activity I want to create a table chart in the dashboard to sum the labels. In my model, I have tokens that get assigned a label (PartNumber) that can be 1014, 1012, 1011, etc. and need to sum all like-labels that flow through that activity. The table chart should have each label (1014, 1012, 1011, etc) as column headers with the sum of how many tokens with that label passed through that activity in the row below. I've tried the statistics collector with an event listening to On Entry but am having a problem building the table that sums the labels and instead is listing out each entry. Is there a way to provide a quick example of how this is done?

FlexSim 21.0.1
labelchartsflexsim 21.0.1
· 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.

Joerg Vogel avatar image Joerg Vogel commented ·

There is certainly a method with a statistical collector. I can think right now about a different approach. You fill a global table. First you identify if the label is already present. You check if it is an element in an array by method indexOf. If it isn’t then you append a column to the table and increment the value by 1. Naturally you push the label value to the array. If the label column exists, then “indexOf” returns the column that you increment by 1. You print the global table in your dashboard.

1 Like 1 ·
dougdurbin avatar image dougdurbin Joerg Vogel commented ·

Thank you! I always forget the indexOf method. Both answers are very helpful!

0 Likes 0 ·
Jason Lightfoot avatar image
1 Like"
Jason Lightfoot answered dougdurbin commented

Example attached.

The row value should be data.token.PartNumber

The column PartNumber should be data.rowValue

The column Sum should be set to increment

The event needs to know that updates should affect the "Sum" column.

SumPartNumbers.fsm


sumpartnumbers.fsm (36.9 KiB)
· 1
5 |100000

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

dougdurbin avatar image dougdurbin commented ·

Thank you Jason! I had the data.token.PartNumber row value correct, but missed the column entry as data.rowValue and makes much more sense!

0 Likes 0 ·
Joerg Vogel avatar image
1 Like"
Joerg Vogel answered

I assume the label value is the column name. You check if the column name exists in your collectors table. If the answer is true you increment the cell value otherwise you add a column to the table With cell value by 1.

Alternatively you push the label value to a global list which stores only unique values. The list should sum up the values.

5 |100000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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