question

Stan Davis avatar image
0 Likes"
Stan Davis asked Stan Davis commented

Slot Label Values Set Via Script Console Not Retained After Reset

Using the Script Console, I have code the sets slot labels. I see those values change in the tree. I am not running the model. However, when I click reset, the set values are reset to default values. Why is this? I need the slot labels to retain their set values.

This question was asked as a follow-on comment here but was never answered...

https://answers.flexsim.com/questions/74398/problem-with-slot-labels-in-warehousing-module.html?childToView=75111#answer-75111


Thanks

FlexSim 22.2.0
flexscriptslot labels
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

Jeanette F avatar image
0 Likes"
Jeanette F answered Stan Davis commented

Hello @Stan Davis,

From my understanding this is how the developers created it. I think the case that made them decide this is when the slot label is set based on incoming items so only the same label is in that slot. Then when the model is reset all the labels are removed so that the next iteration of the model starts with no labels so that the way flow items come in that model decides the labels on the rack and not the previous model run.

This is inconvenient for when you are using code to set up the labels on your rack though. I suggest using an on reset or on model start trigger to trigger the code to set the labels on the racks.

· 3
5 |100000

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

Felix Möhlmann avatar image Felix Möhlmann commented ·

You could also use the code that the "Paint Slot Labels" tool utilizes. Apart from setting the label value, this also creates a "resetLabels" node, so that the label will be reset to the given value.

treenode slot = SO_Rack.bays[bay].levels[level].slots[1].as(treenode);
function_s(slot, "paintLabel", "labelName", labelValue, 1);

Note that the "slot" variable is a treenode, not a Storage.Slot. The developers do not guarantee forward compatability when using internal commands like this.

0 Likes 0 ·
Stan Davis avatar image Stan Davis Felix Möhlmann commented ·
Thanks Felix. I saw the "function_s" in another solution but thought it was custom to the model. I couldn't find it in the model after downloading it. Now I know where it comes from. I will evaluate its usage. Thanks again - Stan

0 Likes 0 ·
Stan Davis avatar image Stan Davis commented ·
Thanks Jeanette. Yes, inconvenient. I'll put it on the reset trigger. Thanks again - Stan
0 Likes 0 ·