question

Talia Z avatar image
0 Likes"
Talia Z asked Talia Z commented

Create tokens based on global table column condition

Hello! My hope is to create tokens based on the value of a cell within a global table. I've created an example model to explain this in more detail and have attached it below. I have a global table named 'Inventory' hosting two columns titled 'ID' and 'ZONE'. I want to create 10 tokens that have the 'ZONE' label 'Left'. In other words, I am hoping to create a set number of tokens from the 'Left' zone by looking through the inventory table and selecting the rows with the corresponding label. I then proceed to create the objects with these labels, so ideally the queue would be filled with boxes that carry the following IDs: 1, 3, 4, 5, 8, 9, 10, 12, 13, 15. I am currently creating the first 10 objects in the inventory table and assigning ID and Zone labels, as shown in the image below, so the queue contains boxes from Zones 'Left', 'Right' and 'Center', which is not ideal. Do you have any suggestions for how to add this condition? Thank you in advance for your help!

FlexSim_table_condition_question.fsm

FlexSim 20.0.10
global tableflexsim 20.0.10create tokenssyntax
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

·
Eric M avatar image
0 Likes"
Eric M answered Talia Z commented

Hi @Talia Z, I did this by using a query based on this example in the manual. I basically query the table to find everything with the Zone label "left" and order it by the ID column. I then use that result to create the labels on the token which can then be transferred to the objects. Also, in the code I stored the "result" from the query to a table called "LeftZone." This is unnecessary and can be deleted, but I thought I'd include it to help you see what the query is doing and how the labels are able to be created based off of it. It's also a nice way to double check that your query code is doing what you expect it to.

flexsim-table-condition-question-em.fsm


· 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.

Talia Z avatar image Talia Z commented ·
Thank you for your response, @Eric M! This solution works well and makes a lot of sense.
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.