String expression in Assign Labels

String expression in Assign Labels

mischa_spelt
Advisor Advisor
1,070 Views
4 Replies
Message 1 of 5

String expression in Assign Labels

mischa_spelt
Advisor
Advisor

[ FlexSim 20.2.2 ]

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

32458-1599743237078.png

Sample model: AssignLabelsConcatStrings.fsm

0 Likes
Accepted solutions (1)
1,071 Views
4 Replies
Replies (4)
Message 2 of 5

philboboADSK
Autodesk
Autodesk
Accepted solution

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.



Phil BoBo
Sr. Manager, Software Development
Message 3 of 5

mischa_spelt
Advisor
Advisor

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.

Message 4 of 5

philboboADSK
Autodesk
Autodesk

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:

32511-1599836412177.png

Event-triggered Source Token Name:

32512-1599836421278.png

32495-1599836427399.png

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



Phil BoBo
Sr. Manager, Software Development
0 Likes
Message 5 of 5

philboboADSK
Autodesk
Autodesk

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.



Phil BoBo
Sr. Manager, Software Development
0 Likes