Process flow does not recognize labels created with assign label when using string in global macros

Process flow does not recognize labels created with assign label when using string in global macros

axel_kohonen
Not applicable
144 Views
8 Replies
Message 1 of 9

Process flow does not recognize labels created with assign label when using string in global macros

axel_kohonen
Not applicable

[ FlexSim 16.2.2 ]

Hi,

I have noticed that if you want to access a label defined in process flow in an "Assign labels" activity one has to define the label name as a string in the menu. I tried to assign the name using a string defined in the global macros, but in this case process flow does not recognize the created label and it is not visible in the labels menu in other activities.

Is this a bug?

See the attached screenshot and model for what is going on. I can circumvent the problem by adding a dummy Assign labels activity where I enter the string manually, but the purpose of using macros is that I would not need to change the code manually if I change the name defined by the macro.

Thank you!

Kind regards,

Axel

3913-86pmi.png

0 Likes
Accepted solutions (1)
145 Views
8 Replies
Replies (8)
Message 2 of 9

sam_stubbsYXX86
Community Manager
Community Manager
Accepted solution

The Label's name seems to be set properly:

3950-testlabel.png

What your picture is showing is the dropdown menu for the Delay activity. You're trying to select a token label from a list of initial token labels. But since you're setting that token label's name dynamically, it's not going to be on list of available token labels to select.

If you're wanting to reference the token label dynamically you could set the delay field to read:

getlabel(token,L_TEST_LABEL)

or just

getlabel(token,"Test")

both would work in this case.

testlabel.fsm

Message 3 of 9

axel_kohonen
Not applicable

Hi @Sam Stubbs

Thank you! Ok, so it is not possible to use dynamic label names in process flow. Would that be something that you could consider adding? Maybe only to the assign labels activity (maybe in the pick list?) which would be simpler than adding it to any custom code (which probably is very hard).

I can generally use your solution with getlabel to get the correct labels. However, when I want to set the token color or shape (in process flow visualization) then the token labels have to be found in the pick list of available token labels so that I can use them for choosing the color or shape of the token. So there I have circumvented the problem by adding a dummy assign labels activity. Here I cannot use a dynamically named label though, but that is generally not a big issue.

Kind regards,

Axel

0 Likes
Message 4 of 9

joerg_vogel_HsH
Mentor
Mentor

if your structure of labels does not differ, you could access the different labels just by their rank instead of their name.

Message 5 of 9

sam_stubbsYXX86
Community Manager
Community Manager

I think you misunderstood what I was saying. You CAN use dynamic labels in Process Flow. It's just that the list of dropdown predefined labels won't be populated, because a dynamic label (by definition) is not predefined. If a label is set during a model's run (as in your example) FlexSim won't know ahead of time what label to populate the predefined list with. Does that make sense?

But in your code if you were to write Label: Test on the Delay's duration, it would still work. Or you could use getlabel(token, MACRO_NAME) as well. etc etc. You absolutely can use dynamic labels. You just won't see their names in the predefined list of label names, because as I said, they haven't been predefined yet..

Message 6 of 9

matt_long
Not applicable

Accessing labels by rank on 3D objects is fine, but you cannot access labels by rank on Tokens.

Message 7 of 9

axel_kohonen
Not applicable

Hi Matt,

Thank you for letting me know about that.

Axel

0 Likes
Message 8 of 9

axel_kohonen
Not applicable

Hi @Sam Stubbs

Sorry if I was unclear. I do understand that you can use the dynamic labels (as I am using them currently), but if you want the list to be populated you cannot use dynamic labels. This also means that if you want a label that you use for the visualization to set the color or shape of the token (see image processflowlabels.jpg) then you have to use a label defined non-dynamically as only pre-defined labels will be available here.

So from FlexSim's point of view the macros are dynamic?

Also, would it be possible or desirable to add a pick list option to the visualization label references so that one could select the label dynamically also here? Then I could use the dynamic labels everywhere.

Thank you!

Axel

0 Likes
Message 9 of 9

matt_long
Not applicable

They are dynamic in the sense that they aren't evaluated until run time and they are only evaluated by the compiler, not by any of the GUIs.

If you wanted to be able to use a Macro to define the token color and shape, then you'd be defining it by code (which is actually possible to do when defining text displayed on tokens). This of course is slow if you're having to evaluate the code for each token on every draw.We could add some kind of weird mechanism that would evaluate the code once on reset and then store the evaluated string.But this would really only help in the case of using macros.

I would think that using macros for label names is a lot less common then just typing a name. Especially with the new dot syntax, your code changes from :

token.labelName

to

token.labels[LABEL_NAME_MACRO].value