question

Sonia A avatar image
0 Likes"
Sonia A asked Sonia A commented

How to automatically call slot labels with code

Hello Everybody,

I am working on a model in Flexsim in which I would like to automatically create labels in a storage system based on the number of pallets that I store in the slot. I have used this code and it works:

If I am not mistaken, with the code above, every slot address has two labels: SKU1 and SKU2.

In another code I would like to select the address of the slots and change the value of the labels that I have created above. I get the address of the slot from labels on my token that indicate the number of corridor, level, bay etc. and based on a condition I decide whether to assign the value "token.UDC.sku" to the slot label SKU1 or SKU2. If I am storing the first pallet, then the label SKU1 of that slot should be equal to the SKU of the pallet (token.UDC.sku). If I am storing the second pallet, I would like to set the value of the slot label SKU 2 equal to the SKU of the pallet (token.UDC.sku).

If I have three stored pallets I would need three slot labels (SKU1 SKU2 SKU3) and I would need to expand the code above to cover the condition if(token.cpal == 3). Since the number of pallets in the slot can vary, I wanted to automatize this system and I have tried to write the code below.

The problem is in the way I call the label of the slot. If I call it directly by its name (SKU1 or SKU2) it works but if I use the last code that I showed, it does not work because I cannot refer to the label of the slot address by using "concat...".

Does anybody know how to solve this problem and how to refer to a slot label without directly writing its name in the format .labelname?

Thank you so much for your help!

FlexSim 21.0.3
flexscriptstorage systemflexsim 21.0.3slot labelsaccessing labels
1616500117943.png (20.3 KiB)
1616500497510.png (16.6 KiB)
1616500631218.png (17.0 KiB)
5 |100000

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

1 Answer

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Sonia A commented

object.labels["SKU"+mynum].value



· 5
5 |100000

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