question

Aaron C avatar image
0 Likes"
Aaron C asked Aaron C commented

How do you get a Table from a treenode?

I feel like I'm missing something really simple... I've been reading about optimizing your model. I'm attempting to stop calling: Table someTable = Table("TableName"); as apparently if you're doing this a lot, it slows the model down. I want, instead, to have a global variable that points to the table, so I set up this global variable:
Name: somePointer, Type: Tree Node, Value: MODEL:/Tools/GlobalTables/TableName

Now in Flexscript, I want to do something like:
double sum = someTable[1][3] + someTable[4][3];

But I'm having trouble with just creating "someTable". I've tried:
Table someTable = somePointer; // Didn't work
Table someTable = somePointer.as(Table); // Didn't work

Not sure what else to try....

FlexSim 19.1.0
tablestreenodecasttable class
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

·
Phil BoBo avatar image
1 Like"
Phil BoBo answered Aaron C commented

MODEL:/Tools/GlobalTables/TableName is the path to a GlobalTable object that contains table data in its variables.

You want to point your global variable at the table data node itself: MODEL:/Tools/GlobalTables/TableName>variables/data


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

Aaron C avatar image Aaron C commented ·

Ah! That was my problem! I was able to simply call tableNode. as(Table) and it worked perfectly! Thanks!

0 Likes 0 ·

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.