Tamilselvan avatar image
Tamilselvan asked Ben Wilson edited

Table inside a token?

Is it possible to have a table inside the token, so that I can assign the responsiblities inside the token itself

Thanks in Advance

FlexSim 23.1.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.

1 Answer

Felix Möhlmann avatar image
Felix Möhlmann answered Jason Lightfoot edited

Yes, you can assign a Table as a label to the token. There are actually mutliple ways of how a table can stored in FlexSim.

Ba default a global table stores each cell value as an invididual node in the tree. The rows are subnodes of the 'table node' and the columns are subnodes of the rows and hold the values.


After you have created a label on the token, you can cast the label node as a table and start to add columns and rows to it. To access the label node, rather than the value stored in it use this syntax:

Table table = token.labels["labelName"];
//Example code
table[1][3] = 5;

A table can also be stored as the value of a single node, as a Bundle. After creating a label, you set its data type to bundle. Then you can cast it as a table and add/read values as above.
There are also special commands to edit/access bundle nodes. (Type 'bundle' into the command helper search and you will see them). Accessing the bundle is faster than the node table in general and using those commands again provides a significant increase in speed. If you access the table very often, using a bundle would be advisable.


The third way to represent a table is as a 2-dimensional Array. (A classic table would be 2-dimensional (rows and columsn) though if it's useful to you there is nothing stopping you from using higher dimensions as well.)


The attached model contains an example for all three types. The data written to the table is taken from GlobalTable1 in all cases.


capture1.png (5.5 KiB)
capture2.png (4.8 KiB)
capture3.png (8.2 KiB)
labeltable-fm.fsm (30.0 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.

Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·

You might also want to consider a Map type which is similar to an array but keyed off something you choose: a string, object, number, array etc.. The upsides are simplicity, power and speed - the downside is they are not as easy to visualize/depict in a view.

0 Likes 0 ·