question

Mischa Spelt avatar image
0 Likes"
Mischa Spelt asked Phil BoBo edited

String expression in Assign Labels

When I enter a string expression such as "Hello " + "World" in Assign Labels, it is not parsed correctly: the label is assigned the value

Hello " + "World

As a workaround, I can put the expression in brackets. Then suddenly FlexSim considers it a script and shows the "Code editor" button to the right of the field, and everything works as expected with a label value of

Hello World

Sample model: AssignLabelsConcatStrings.fsm

FlexSim 20.2.2
flexsim 20.2.2assign labelsstrings
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

·
Phil BoBo avatar image
1 Like"
Phil BoBo answered Phil BoBo edited

Yes, that field assumes that if the first character is a quotation mark, that you are entering a string.

As you did, if you want to evaluate it as code, then wrap the expression in parentheses.

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

Mischa Spelt avatar image Mischa Spelt commented ·

Perhaps you could consider supporting it without the parentheses as well. After all, basically everywhere else in the software this does work. I realize the field is not a Universal Edit because it doesn't a blue border, but from a user perspective, based on my previous experiences, I did really expect this to work. Thanks.

1 Like 1 ·
Phil BoBo avatar image Phil BoBo ♦♦ Mischa Spelt commented ·

Universal Edits no longer draw blue. That is a Universal Edit. That's why it behaves this way.

"After all, basically everywhere else in the software this does work."

Where else exactly in the software can you enter a string value that isn't executed as code and "this does work"?

I'm trying to find fields that return strings and work differently than this field, but I keep finding fields that return strings that work the same way as this field. This is how these fields have always worked.

For example, Push To List Partition ID:

Event-triggered Source Token Name:

Maybe these types of fields shouldn't behave like this, but they do and they always have. Precisely because they are Universal Edits.

0 Likes 0 ·
1599836412177.png (50.3 KiB)
1599836421278.png (18.9 KiB)
1599836427399.png (13.7 KiB)
Phil BoBo avatar image Phil BoBo ♦♦ Phil BoBo ♦♦ commented ·

After discussing this with the developers who implemented it, the best solution seems to be to improve how the Universal Edit determines that the user entered a string. I'll add a case to the dev list to improve that algorithm to consider more than just the first character to determine whether it is a string.

0 Likes 0 ·

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.