question

Chris Ligetti avatar image
0 Likes"
Chris Ligetti asked Matthew Gillespie answered

Global Table lookup using row and column names

@Kari Payton, I stumbled upon this thread (https://answers.flexsim.com/questions/28568/is-there-a-way-to-do-a-global-table-lookup-using-r.html) when I had a similar need, and it has been very helpful. One thing I am struggling with is how I can possibly relate a string label on an item to the Global Macro. For instance, regarding the above example, I would have an item with labels:

type = "R_Trucks"

brand = "C_Chevy"

(in my case, the value of this label would always be identical to the Glabal Macro values). However, I realize that I cannot just use gettablenum("myTable", item.type, item.brand).

Any ideas on how I could correct to achieve the behavior I'm looking for?

FlexSim 17.0.0
global table
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

·
Matthew Gillespie avatar image
1 Like"
Matthew Gillespie answered

As of 17.0, with the new Table FlexScript class, you can use row and column names instead of numbers:

Table table = reftable("Data");
int value = table["RTrucks"]["PartQuantity"];
5 |100000

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

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.