Trying to access tokens labels available in activity

Trying to access tokens labels available in activity

sudheer_r
Not applicable
11 Views
5 Replies
Message 1 of 6

Trying to access tokens labels available in activity

sudheer_r
Not applicable

[ FlexSim 20.1.2 ]

As shown in below image, I am trying to get the the labels of the tokens in Resource activity

Below is the code i am trying but not successful.Any feedback what is the code to get labels value of the tokens waiting in a activity.

Model.find("Tools/ProcessFlow/ProcessFlow/Resource>stats/globalInstance/tokens").subnodes[1].labels[]

29928-r.png

ResourceLabels.fsm

29936-reso.png

0 Likes
Accepted solutions (1)
12 Views
5 Replies
Replies (5)
Message 2 of 6

tanner_p
Not applicable
Accepted solution

@Sudheer Reddy,

I don't think subnodes really works with tokens. You can use child and parent references, though. What I used to access the token in the model you attached is the "gettoken" function. Then you can access labels from there. Hope this helps!

resourcelabels_1.fsm

0 Likes
Message 3 of 6

sudheer_r
Not applicable

@tanner.p Thanks for the feedback.

In below image in script console testObject is Queue3

and in gettoken I am passing Queue3 as testobject. But testObject became irrelevant for the following reasons

what ever the object you pass as testObject the return statement remains same as Queue2.

Here I tried sending testObject as Queue1 and Queue2 and still the return is Queue2.

If whatever testObject you are sending in gettoken still the return is same, then what is the importance of testObject in gettoken.

I'm attaching the model for reference.

resourcelabels-1.fsm

29976-redoubt.png

0 Likes
Message 4 of 6

joerg_vogel_HsH
Mentor
Mentor

@Sudheer Reddy, please set unique names for your activities, then it gets easier to identify the activity you want to get the tokens from!

0 Likes
Message 5 of 6

tanner_p
Not applicable

The testObject can be anything. It's just the owner object and can be anything.

30011-gettoken-help.png

If you want to access a different token, you should change the index value, which is the "1" in the sample script I gave you. Hopefully I understood your question correctly.

30003-index-token.gif

resourcelabels-1_1.fsm

0 Likes
Message 6 of 6

sudheer_r
Not applicable

@tanner.p thanks it helped me.