How do you get a Table from a treenode?

How do you get a Table from a treenode?

aaron_c
Not applicable
22 Views
2 Replies
Message 1 of 3

How do you get a Table from a treenode?

aaron_c
Not applicable

[ FlexSim 19.1.0 ]

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

0 Likes
Accepted solutions (1)
23 Views
2 Replies
Replies (2)
Message 2 of 3

philboboADSK
Autodesk
Autodesk
Accepted solution

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

24026-global-variable-table.png



Phil BoBo
Sr. Manager, Software Development
Message 3 of 3

aaron_c
Not applicable

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

0 Likes