question

Robert Hambright avatar image
1 Like"
Robert Hambright asked Robert Hambright commented

How do I reference a token in a different activity in process flow?

Hello,

zone.fsm

I have tokens entering a zone. The token can only enter the zone if it has the same label "Label" as the tokens that are already in the zone.

How can I reference these tokens already in the zone and format the Decide node correctly?

Thanks

FlexSim 16.2.0
process flowzonedecide
zone.fsm (18.1 KiB)
zone.fsm (18.1 KiB)
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

Matt Long avatar image
3 Likes"
Matt Long answered

In the Assign Labels activity, there is a pick option for Tokens in Shared Asset that will return an array of all of the tokens that have entered the specified Zone.

Under the hood the picklist is utilizing a command called gettokens() which can be used on any activity or shared asset.

Once you have a reference to all of the tokens you can then check the label value of the entering token with one in the Zone (we don't have to check all of the tokens as they'll all have the same label value). You also have to check to see if there are any tokens in the Zone. The code is:

arraysize(getlabel(token, "tokensInZone")) == 0 || getlabel(getlabel(token, "tokensInZone"), "Label") == getlabel(token, "Label")

I've updated your model to show how it this would work.

4097-zone.fsm


5 |100000

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