I have a user interaction box in my script
It produces the attached display and works fine
But when the "abort" button in that box is pressed the script continues setting variables.
Do I need to add something to the script to make the abort button actually abort the script?
Apologies for another newbie question!
Update 2024-06-18:
After receiving the script XML it was found that the script in question is using the graphical UI blocks instead of C# code. These blocks behave differently, so the explanations that were already given would indeed not apply here. Note that aborting a 'User interaction' block will result in this block being skipped without any variable sets. It is up to the user to then make sure that the following conditions will only trigger logic if a button has been pressed. An 'if' condition could be added that will check whether one of the button variables were set, and use the 'Exit' action to stop the script if that would not be the case.
In general, I would recommend moving to C# code for many reasons including: best compatibility, feature availability and future support.
Original reply:
Hi Mark,
Could you share the DataMiner version you are using? As Tom mentioned in his reply, if you abort the script, an exception should be thrown. Here are more details on this flow.
When you click the abort button, or close the window in the top right (+confirm), a 'detach' request will be sent to the script. This will result in the script not running interactively anymore, and cause the 'ShowUI' method to throw the 'InteractiveUserDetachedException'. If this exception were caught and ignored (try/catch, or ignored when wrapped in a 'Task'), the script will just continue running. In any case, the cube window should close when pressing that button, can you confirm that this is the case?
One thing you could do to check this is find the line with 'ShowUI' where the script is currently waiting on when showing the interactive UI and wrap it with a 'try-catch' statement and log the exception in an information event. Then try to abort the script using the button and check the information events to see whether the exception was thrown as expected. This could already help to identify if the button is the issue, or the script. If you use the IAS Toolkit, you can put the line where you call 'Run' on the controller between the 'try' statement.
Thanks for sharing the version. You could use an online sharing service like ‘https://pastebin.com/’ to share the XML if you are fine with it being public. You can also send it privately to my e-mail address: ‘thomas.ghysbrecht@skyline.be’.
Hey Mark, I sent you a reply on the email and updated my response. Let me know if the suggested change fixes your issue.
Version in use:-
DataMiner (10.2.0.0-12603-CU11)
I’m trying to attach the xml export of my script bur the comments box here only alllows text – what’s the best way to send the script to you?