question

Kari Payton avatar image
1 Like"
Kari Payton asked Kari Payton commented

Function in FlexSim like Excel vlookup?

Is it possible to match a value from 2 tables and assign a label from another column of the matched value. Like the Vlookup in Excel?

FlexSim 18.1.0
tables
5 |100000

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

Jordan Johnson avatar image
5 Likes"
Jordan Johnson answered Kari Payton commented

Now that I see your table, I have two possible recommendations. One is to use a query, like in my other answer. However, it does not need a Join, if the token knows the value from one of the tables. At that point, only the second table is required:

Table result = Table.query("SELECT [Order Picking Number] FROM Dimensions_OrderOfPicking WHERE [Item Number] = $1", token.itemNumber);
return result[1][1];

Note that a query makes a table, but in this case, we're making a table with one row and one column, so we can get a single value.

The query method is slow, however, because the table must be searched for the matching value. The longer the table, the slower this method gets.

I would recommend using a list. You can use partitions as a "key" to get the value you need. See the attached model. This method is extremely fast, and does not get slower as the table to search grows. It will cost a little more memory, but it will usually be worth it.

sqlorderpicking-two-responses.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.

Kari Payton avatar image Kari Payton commented ·

Using the lists works the best. I didn't realize you can push a label to a list; only knew about tokens and items. Thanks!

0 Likes 0 ·
Jordan Johnson avatar image
1 Like"
Jordan Johnson answered Jordan Johnson edited

I am guessing you will need to use a query:

SELECT Col3 FROM Table1 JOIN Table2 ON Table1.Col1 = Table2.Col2

If you post a model with two example tables, I will get you an exact query.

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

Kari Payton avatar image Kari Payton commented ·

sqlorderpicking.fsm @jordan.johnson correction use this file instead

0 Likes 0 ·
sqlorderpicking.fsm (18.5 KiB)

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.