question

Adam M5 avatar image
0 Likes"
Adam M5 asked Jeanette F commented

Assigning values from a list to each token using “Assign Labels” in Process Flow

Rim source + tire source create tokens with labels.fsmI am trying to use the “Assign Labels” activity to add a second label to token created from a “Schedule Source” activity. I am deliberately avoiding creating this second label in the Schedule Source as values for this second label will change from month to month; my desire is to change a global table.

I attempted to use the technique described by Felix in a previous question; however, when I attempt to set my Assign Label activity like this:

assign-label-setup.png

which is based on his use of Table(“GlobalTable1”)[tokenIndex][1] syntax/script in a Schedule Source activity,

schedule-source-syntax.png

I get the following error:

error-mssg.png

Is it possible to have the Assign Labels activity pull values from a global table and assign to the tokens?


Thanks for your time!


FlexSim 22.2.0
assign label
· 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 @Adam M5, was Sam Stubbs's answers helpful? If so, please click the "Accept" button at the bottom of the one that best answers your question. 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

·
Sam Stubbs avatar image
0 Likes"
Sam Stubbs answered Adam M5 commented

The error you're getting is because the "tokenIndex" phrase is only relevant inside the Schedule Source, (it won't work inside the Assign Labels activity.) You had the right idea, it should work, but you'll want to save an Index label to your tokens that is the tokenIndex on token creation, that way you can access the index number inside the Assign Labels activity.

The Global Table reference inside your Assign Labels activity with then look something like this:
Table("GlobalTable1")[token.Index][1]

· 17
5 |100000

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

Adam M5 avatar image Adam M5 commented ·

Good afternoon @Sam Stubbs,

So in the Schedule Source activity, you are saying that I add a label like this?

1713471143227.png


When I add the label and the value is zero, this is what a resulting token looks like:

1713471216235.png

Is this correct?

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ Adam M5 commented ·

No the value should be tokenIndex:

1713872867131.png

Also - you can just use the source's arrivals table instead of a global table. You can import to it - it just needs the format of the first three columns to be the same. If you need a reference to it in a script, it's just:

Object source=getactivity("ProcessFlow","Tire Source");
Table arrivals=getvarnode(source,"arrivals");

Update: corrected the image with label name.

1 Like 1 ·
1713872867131.png (6.1 KiB)
Adam M5 avatar image Adam M5 Jason Lightfoot ♦ commented ·

Good afternoon.

In the Schedule Source activity, I assigned a label per @Jason Lightfoot suggestion:

2nd-attempt-label-setup.png

In the Assign Label activity, I used “token.Index” for the name of the label and for value, I referenced the Global Table per @Sam Stubbs suggestion:

2nd-attempt-global-table-reference.png

When running the model, I get both compiler and system console errors; when I click on an individual token, here is what one looks like:

2nd-attempt-label-values.png

I was expecting in the third row (after Rim Ser # and Diameter) to see "ResCode" (from my Global Table) and a respective value from the global table.

I've uploaded a newer version of the model that has the Global Table in it; the "Rim Inventory" Zone is where my focus of effort is now.

Where did I go wrong?


One operator one machine all steps with ResCode Global Table_autosave.fsm

0 Likes 0 ·
Show more comments
Show more comments

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.