Node value syntax

Node value syntax

tomi_kosunen
Not applicable
936 Views
3 Replies
Message 1 of 4

Node value syntax

tomi_kosunen
Not applicable

[ FlexSim 21.2.0 ]

Hi. I can't find the FlexScript syntax to get the statistics value out from the model. I have:

ElevatorBank bank = a.as(ElevatorBank);

treenode B_Elev = bank.elevators[1];

treenode stat_node = B_Elev.find(">stats/state_profiles/Elevator/profile");

How do I get the (for example) "opening door" out from the table?



1632138351081.png



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

philboboADSK
Autodesk
Autodesk
Accepted solution

The Elevator node in your image is a TrackedVariable node. You can access its data and the data in the profile node using the TrackedVariable FlexScript API.

ElevatorBank bank = a.as(ElevatorBank);
Object B_Elev = bank.elevators[1];
TrackedVariable tv = B_Elev.stats.state("Elevator");
return tv.getCategoryName(2);


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

lars_jacobsen_ScandiSim
Advocate
Advocate

Or you can access the data as a bundle table

1632200668489.png


0 Likes
Message 4 of 4

tomi_kosunen
Not applicable
Even better for me. Thanks!
0 Likes