question

Anup Chauhan avatar image
0 Likes"
Anup Chauhan asked Carter Walch commented

Need Help with assigning random value within a column to a token

Hi, I am fairly new to flexsim and was wondering if there is a specific code function in order to select a value within an identified column (column within a global table) by using a distribution (essentially a random value, and use this within the assign label block to give to an incoming source token.

FlexSim 23.1.3
table
· 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.

Carter Walch avatar image Carter Walch commented ·

Hi @Anup Chauhan, was Jordan Johnson's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Jordan Johnson avatar image
0 Likes"
Jordan Johnson answered

You can try code like this:

Table table = Table("MyGlobalTable");
int row = duniform(1, table.numRows);
int col = 3;
token.MyLabel = table[row][col];

Or all in one line:

Table("MyGlobalTable")[duniform(1, Table("MyGlobalTable").numRows)][3]
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.