question

SudheerReddy avatar image
0 Likes"
SudheerReddy asked SudheerReddy commented

Trying to access tokens labels available in activity

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[]

ResourceLabels.fsm

FlexSim 20.1.2
flexsim 20.1.2resource
reso.png (92.9 KiB)
1592500789966.png (14.0 KiB)
r.png (18.5 KiB)
resourcelabels.fsm (30.5 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.

Joerg Vogel avatar image Joerg Vogel commented ·

@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 0 ·

1 Answer

tannerp avatar image
0 Likes"
tannerp answered SudheerReddy commented

@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


· 3
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

SudheerReddy avatar image SudheerReddy commented ·

@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

0 Likes 0 ·
redoubt.png (46.0 KiB)
tannerp avatar image tannerp SudheerReddy commented ·

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

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.

resourcelabels-1_1.fsm

0 Likes 0 ·
gettoken-help.png (11.8 KiB)
index-token.gif (123.0 KiB)
SudheerReddy avatar image SudheerReddy tannerp commented ·

@tanner.p thanks it helped me.

1 Like 1 ·