question

Leah R avatar image
1 Like"
Leah R asked Jeanette F commented

How to reach GlobalTable value from Patient Flow

Hi everyone,

Very naive question here but I just cannot seem to make it work.

In my model, I have :

  • an arrival table where each patient has a unique ID.
  • a global table where each ID is associated with a ProcessTime
  • a simple patient flow with a "walk then process" block

1623913236933.png

1623913213356.png

How can I reach the right process time for each patient from the patient flow ? I guess it would be the flexsim equivalent of : Process Time = Select ProcessTime From GlobalTable1 where ID = patient.ID

1623913309038.png

Thanks in advance !

Leah



FlexSim 21.0.0
globaltablepatientid
1623913213356.png (14.3 KiB)
1623913236933.png (42.5 KiB)
1623913309038.png (56.2 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.

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @Leah R, was Clair A's or Felix Möhlmann's answer helpful? If so, please click the red "Accept" button at the bottom of one of their answers. 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 unaccept and comment back to reopen your question.

0 Likes 0 ·
Clair A avatar image
1 Like"
Clair A answered

Hi Leah,

The answer of @Felix Möhlmann is perfect and generic.

Here is an alternative, not generic, but specific to the way you filled your global table:

Table("GlobalTable1")[patient.ID/10)]["ProcessTime"]

Since each ID in your table is equal to 10 times the row index.

5 |100000

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

Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered

The command

Table(string TableName).getRowByKey(Variant key, Variant col)

gets the first row number where the value in column "col" is equal to "key".

So in your case the full expression would be:

Table("GlobalTable1")[Table("GlobalTable1").getRowByKey(patient.ID, 1)]["ProcessTime"]


5 |100000

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