question

Amanda Prado avatar image
0 Likes"
Amanda Prado asked Gustavo Teodoro answered

Search the global table for the label value and return the column value

Good afternoon everybody !

Simulation:

Warehouse Payment System, where 50 items types are paid for SPMKT. I'm creating 50 items types through 50 sources. Each source, when creating the item, already configures a label with the item's respective Part Number.

As the number of boxes for each item are different, each item has a different number of boxes that the operator picks up at a time and, for this reason, all the logic is happening in the process flow.

I have a Global Table that contains the Part Numbers and the quantities that need to be paid at a time. The point of my doubt is the following:

I'm using a list in PF to pull items according to my global table:


1732125386055.png

It turns out that there are 50 Part Numbers and I am imputing the line number for each item. I would like to know if there wouldn't be a way to make Flexsim look for the line in my table, using the label I created in the source, and return the value column, something like this, more or less:

Table("BOM")[item.(labelname)][colum] ????


As well as the load and unload locations, I am configuring them manually, but I would like you to pull, according to the label, the origin and destination location, which is also included in the Global table.

I hope I was able to be clear enough on the issue.


Thank you very much !

Yours sincerely.

FlexSim 24.2.1
global table
1732125386055.png (26.3 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.

Gustavo Teodoro avatar image
0 Likes"
Gustavo Teodoro answered

An alternative approach would be to use the process flow to create the items. This way, it will not be necessary to use the 50 Sources.
In the quantity field, use the command Table("GlobalTable1").numRows, so the number of tokens created will correspond to the number of rows in your Global Table. To assign information to the token, you can reference the table and use the tokenIndex command. This command indicates the order in which the token was created and retrieves the information from each row of the table.

1732192410049.png

In the attached example, the label information includes quantity, source, and destination.
Afterward, the items are created at the destinations and in the quantities according to the information already stored in the token. These details can also be transferred to the items using the create objects command.

1732192476983.png

An example is attached.

FX_CreateObjects.fsm


1732192410049.png (92.4 KiB)
1732192476983.png (65.6 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.

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered

The "getValueByKey" method does this.

https://docs.flexsim.com/en/24.2/Reference/CodingInFlexSim/FlexScriptAPIReference/Data/Table.html#Method-getValueByKey

Though I don't see a reason why you couldn't also have the row number as a token label, since using that directly will be faster than having to search the table for a matching value each time.

5 |100000

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