question

Preet avatar image
0 Likes"
Preet asked Preet commented

Use Token.Event coming from a global table

sample_model.fsmAsking this question by converting my issue with a simple example. I have a more complex model than this and the values in the global are actually updated through multiple conditions.

In the attached model, I have a global table which have tracked variables that updates automatically. However I want to listen to these changes (wait for the event) and see what was the trigger that fired the event. Based on the location I want to do something. For example do something if it was triggered by row 1 VS do something if it was triggered by row 2.

1699486861736.png

I am assigning the triggering event by token.Event and can see that token did receive the information. So when I print I get this location.

/Tools/GlobalTables/GlobalTable1>variables/data/Row 1/Col 1

However, how would I check the condition that does that string is equal to "/Tools/GlobalTables/GlobalTable1>variables/data/Row 1/Col 1" OR
"/Tools/GlobalTables/GlobalTable1>variables/data/Row 2/Col 1.

The conditional statement is failing to recognize the location. Even I tried string.include, string.search functions but nothing works. At least if I can pull if the string contains Row 1 OR Row 2, I can do rest of the work but struggling to get that.

I have used token.Event in other models on 3D objects and processflow events and that worked fine. However not working for tracked variable in global table.

Any help will be appreciated.

Thanks!


FlexSim 23.2.1
token.event
1699486861736.png (40.2 KiB)
sample-model.fsm (31.9 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

·
Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered Preet commented

The "Event" value is not a string but a pointer to the node that represents the table cell (pointer values are displayed with a purple font).

In the Decide activity you would have to compare it to the treenode (token.Event == Model.find("...")).

But you can also get the column and row number as the rank of the node and its parent respectively. That way you can use the number to determine to connections to send the token to (directly or in a "By Values" option).

1699508224916.png


1699508224916.png (16.1 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.

Preet avatar image Preet commented ·

Thank you @Felix Möhlmann ! That Model.find("...") worked smoothly!

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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