question

Axel Kohonen avatar image
0 Likes"
Axel Kohonen asked Matt Long commented

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

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

FlexSim 16.2.2
process flowbuglabel assignment
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

Sam Stubbs avatar image
2 Likes"
Sam Stubbs answered Matt Long commented

The Label's name seems to be set properly:

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


testlabel.png (9.4 KiB)
testlabel.fsm (14.6 KiB)
· 7
5 |100000

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

Axel Kohonen avatar image Axel Kohonen commented ·

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 0 ·
Sam Stubbs avatar image Sam Stubbs ♦ Axel Kohonen commented ·

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..

2 Likes 2 ·
Axel Kohonen avatar image Axel Kohonen Sam Stubbs ♦ commented ·

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 0 ·
Show more comments
Joerg Vogel avatar image Joerg Vogel Axel Kohonen commented ·

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

1 Like 1 ·
Matt Long avatar image Matt Long Joerg Vogel commented ·

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

2 Likes 2 ·
Show more comments