question

dougdurbin avatar image
0 Likes"
dougdurbin asked Joerg Vogel commented

Object by Case Using String

What's the best way to decide a destination based on an acquired resource? In my model I acquire an AGV (token.AGV). I need a different destination based on which AGV has been acquired. I'm looking at a travel activity where the Task Executor is token.AGV but the destination is where I'm having a problem. I'm looking at the Object by Case option using the Case Function: token.AGV which returns a string value and I know the "by Case" option can't use string values. Is there a better way to reference the string (token.AGV) to determine a destination?

FlexSim 21.0.1
flexsim 21.0.1stringobject by case
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

·
Jeanette F avatar image
1 Like"
Jeanette F answered Joerg Vogel commented

Hello @doug.durbin,

You could use a global table that had the AGV's stored as one column and the other column be all the destination values the AGV's correlate to. To find the correct row and return the value of the 2nd column using the following.

Table("GlobalTable1").getValueByKey(token.AGV, 2, 1)


1610661654621.png (50.8 KiB)
· 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.

Joerg Vogel avatar image Joerg Vogel commented ·

I put all destinations into an array and then I lookup the array by the indexOf(destination).

This returns the index as an integer value which is easy to handle in switch by case.

1 Like 1 ·

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.