question

Hannah S avatar image
0 Likes"
Hannah S asked Ben Wilson commented

Can you use a looped token to access labels using token.pulled?

In my model I have a process flow that uses looped tokens. I generate 1 token at the start, send it through a process flow, and then once the process flow is completed I send it back to the start of the process flow. At the top of the process flow is a "Pull from List" block followed by an "Assign Labels" block. I use the "Assign Labels" to access labels from the item I pulled from the list using token.pulled.label. This works the first time I send the token through the process flow. The second time I send the token through the process flow I can still pull an item from the list, but when I try to assign a label I get the following error "FlexScript exception: Retrieving - label property on node that does not exist at MODEL:/Tools/ProcessFlow/ProcessFlow/Assign Labels>labels/1/2." In the test model I built to submit here I can't even send the token through once without getting this error. What am I doing wrong? Is there a better way to access labels on a pulled token?

List Error.fsm

FlexSim 20.2.3
flexsim 20.2.3tokensglobal list
list-error.fsm (30.5 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.

Ben Wilson avatar image Ben Wilson ♦♦ commented ·

Hi @Hannah S, was Logan Gold's answer helpful? If so, please click the red "Accept" button on 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 unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Logan Gold avatar image
0 Likes"
Logan Gold answered

In the test model, as soon as a token is pulled off the Test List, it goes from the "Push to List" activity to the Sink and is destroyed. This happens before the puller token can finish at the Assign Labels activity that is assigning the Number label.

That means when token.pulled.Number is accessed in the Assign Labels activity, token.pulled is NULL, because token.pulled is trying to reference a token that has been destroyed.

The fix for the sample model is to add a Delay activity after the "Push to List", using 0 for the Delay Time. This gives the puller token a chance to set the Number label before the pulled token is destroyed. This will probably work on your main model as well if it is the same error message ("node that does not exists"), but try it and let us know.

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.