question

sara S2 avatar image
0 Likes"
sara S2 asked Matthew Gillespie commented

FlexScript exception: label ArrivalGroups doesn't exist on token id: 142 !

Hello,

I am modeling a hospital process in the attached model, where the first patients arrival (named group 1 and contains 3 patients) in the process flow 2 have two delays (delay1 and delay2) according to their locations (location 1 and location 2). The next patients arrival (named group 2 and contains 3 patients) have different delays (delay3 and delay4) from the two mentioned ones (delay1 and delay2). In order to model this, I assigned a label to the created tokens of process flow 2 (Fig1), then I fixed the mentioned four delays according to decision "decide" about this label value (Fig2). But, I get the following error (ERROR):

FlexScript exception: label ArrivalGroups doesn't exist on token id: 142 at MODEL:/Tools/ProcessFlow/Person Flow2/Patient of group1? >variables/decision

I really don't understand why the label doesn’t exist while it is well defined. Please help me to fix this.

fig1.png

fig2.png

error.png

Regards.

process flow
fig1.png (122.9 KiB)
fig2.png (113.3 KiB)
error.png (142.0 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.

sara S2 avatar image sara S2 commented ·

Here is the model :

hospital1.fsm

0 Likes 0 ·
hospital1.fsm (58.2 KiB)

1 Answer

Matthew Gillespie avatar image
0 Likes"
Matthew Gillespie answered Matthew Gillespie commented

You assign the label to a token in the Arrivals flow and then that token goes to the Create Person activity. When that activity creates a person it copies all the token labels onto the person, so now the ArrivalsGroup label is on the person.

So in the decide activity you should change the code from token.ArrivalsGroup to

current.ArrivalsGroup
since current refers to the person in a person flow.
· 2
5 |100000

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

sara S2 avatar image sara S2 commented ·

Thank you @Matthew Gillespie for your help.

When I set "current.ArrivalsGroup" I don't get the error message, but all tokens go to group1 and wait the delays of group1, even the tokens that belong to group2.

Would you please help me to fix this.

hospital1.fsm

0 Likes 0 ·
hospital1.fsm (58.2 KiB)
Matthew Gillespie avatar image Matthew Gillespie ♦♦ sara S2 commented ·

You had a mistake in the code where you set the ArrivalsGroup label:

if(rowNumber=1)

this sets rowNumber equal to 1 and then returns true for the if statement. You meant to say:

if(rowNumber == 1)

which actually compares the value.

I simplified it by just using the rowNumber variable itself.

hospitalfixed.fsm

0 Likes 0 ·
hospitalfixed.fsm (58.0 KiB)