question

hermione12 avatar image
0 Likes"
hermione12 asked hermione12 commented

How to use getRowbyKey?

Hello,

I am confused about getRowbyKey("key","columnname").

What should I write in "key" ?

For example :

ts.addTask(TASKTYPE_TRAVEL,Model.find(Table("GlobalTable" [Table("GlobalTable").getRowByKey("",1)]["Destination"]));

1659088548281.png


FlexSim 20.0.10
getrowbykey
1659088548281.png (5.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
0 Likes"
Felix Möhlmann answered hermione12 commented

The key is the value that identifies the row. 'getRowByKey' will return the number of the first row in which the value in "columnname" is equal to "key".

· 6
5 |100000

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

Jeanette F avatar image Jeanette F ♦♦ commented ·
For instance
Table("Global Table").getRowByKey("Part2", "PartName");

will return 2

0 Likes 0 ·
hermione12 avatar image hermione12 Jeanette F ♦♦ commented ·

Hey @Jeanette F

Thanks for the command line. If I want to generalize and refer all the rows and not particular row?

Table("Global Table").getRowByKey("", "PartName");

I do not want particular 2 to be returned. Instead I want to read all the rows.

What to write in the command?

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann hermione12 commented ·

What do you mean by "I want to read all the rows". What value(s) do you want to extract from the table?

0 Likes 0 ·
Show more comments

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.