question

Nathan S7 avatar image
0 Likes"
Nathan S7 asked Joerg Vogel answered

Pulling multiple items from a list not saving token references

I am trying to have a token pull multiple items from a list, then keep these token IDs as an array for each item pulled. When I have the token enter the Pull from List block, it successfully pulls what I want and has an array of the tokens pulled under the token.pulled label. However, if that token continues along and does other operations (like a delay step), the token.pulled label becomes NULL. How do I keep this information in the token.pulled label? Why is it getting overwritten?

FlexSim 21.2.4
listslist pull
· 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 @Nathan S7,

It's hard to know how to help without looking at your model. To receive a more accurate solution, please post your model or a sample model that demonstrates your question.

Proprietary models can be posted as a private question visible only to FlexSim U.S. support staff. You can also contact your local FlexSim distributor for phone or email help.

0 Likes 0 ·

1 Answer

·
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered

Your references in your array got erased. This happens if those tokens provided the values of your array got into a sink. Or the Array values are manipulated somewhere else in your model. An Array is a special construct in a programming language. It is a pointer to an address field in system memory and it is NOT a field of values in the scope of FlexSim. If you address an element of an array for a change, then you change everywhere in your model this value. If you do an operation with elements of an array then you store those operations but not the results as changed values. You want to get a copy of an array you have to assign a different memory field in your system for this copy. AND you must do this by a method rather than by a simple assignment. Please look for suitable methods in manual about array class datatype.

https://docs.flexsim.com/en/21.2/Reference/CodingInFlexSim/FlexScriptAPIReference/Data/Array.html

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.