Flexscript exception on message trigger

Flexscript exception on message trigger

Prateek_mund
Not applicable
113 Views
3 Replies
Message 1 of 4

Flexscript exception on message trigger

Prateek_mund
Not applicable

[ FlexSim 22.0.16 ]

hello everyone i am reframing my question as i was able to figure out what is going wrong. So I have set some conditions for processor 1 in my model such that on-process-finish trigger does closeoutput. Now when i set a openoutput condition in the on-message trigger, it showed an flexscript exception. The reason for this was that in the on-message trigger i am creating an if condition that looks at the item label value. Now if i remove the condition where it checks for my item label it works fine, but i do need it to check for my item label value. The item is referenced in the code as "Object item=param(5);". Do i need to reference in some other way?

0 Likes
Accepted solutions (1)
114 Views
3 Replies
Replies (3)
Message 2 of 4

moehlmann_fe
Enthusiast
Enthusiast
Accepted solution

If you know when and where the error happens, you can set a break point in the code and step through it line by line, so see what exactly is going wrong.

In this case, you assign the "item" variable as the fifth trigger parameter. But the message trigger only supports four parameters. I don't know where the header of the trigger comes from (maybe an old version?), but you will have to update it. If the variable is supposed to point to the item that might currently be inside the processor, then you can use "current.first".

Then check if it actually exists with "if(objectexists(item))".

capture1.png

0 Likes
Message 3 of 4

Prateek_mund
Not applicable
Hi Felix, thank you for the reply. I guess i just figured out the same thing that the item was the cause of the error. Would this work "Object item= current.first" .
0 Likes
Message 4 of 4

moehlmann_fe
Enthusiast
Enthusiast
Yes, but as I said, you should check if there actually is an item in the processor before executing the rest of the code.
0 Likes