question

lyn-lyn11 avatar image
0 Likes"
lyn-lyn11 asked lyn-lyn11 commented

Flexsim Version 2023.0.1 Flexscript Error

Hi, I have a model version 2018.2 have no issue on executing a switch case but the error prompting in version 2023. I tried version 2022, it prompted the same error, stated: "Switch statement cannot contain statements outside of a case."


The case function were coded at decision point upon on arrival by incoming item.


Code:

1673402899212.png


The Flexscript error:

1673402956140.png


Can help to check on this bug and any work around temporarily?

FlexSim 23.0.1
flexscript errorflexscript exception
1673402899212.png (325.0 KiB)
1673402956140.png (23.7 KiB)
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

·
Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered lyn-lyn11 commented

Version 18.2 uses the switch case in the "Send By Case" option, whereas newer versions (not sure where exactly the change was made) use the if-statements instead, to allow for non-number case variables.

What likely happened:

You opened the old model in 23.0.1 which would keep the old code. However when you open the pick option's GUI, the code would update and replace the cases with the if-statements from the newer version, ending up with invalid syntax.

It would probably be best to delete the trigger and then add it again to fix the generated code.

· 1
5 |100000

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

lyn-lyn11 avatar image lyn-lyn11 commented ·

Thanks for the help!

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.