Page 1 of 1

How to set a srvroutine in a "Failed" state programmatically

Posted: Fri Oct 21, 2016 5:37 pm
by dvanoni
Hi all!

is it possible to set a srvroutine in a "Failed" state programmatically?

Thanks

For example:

Code: Select all

Srvroutine Name(my_srvroutine)
	if cond(some_condition)
		* Set "Failed" state
		Return
	endif
Endroutine

Mthroutine Name(my_mthroutine)
	Define_com Class(#MySrvModule.my_srvroutine) Name(#my_srvroutine)
	my_srvroutine.Execute
	Evtroutine Handling(my_srvroutine.Completed)
	
	Endroutine
	Evtroutine Handling(my_srvroutine.Failed)
	
	Endroutine	
Endroutine

Re: How to set a srvroutine in a "Failed" state programmatically

Posted: Fri Oct 21, 2016 5:54 pm
by MarkD

Re: How to set a srvroutine in a "Failed" state programmatically

Posted: Fri Oct 21, 2016 6:21 pm
by Stewart Marshall
Dividing by zero works nicely too

Re: How to set a srvroutine in a "Failed" state programmatically

Posted: Fri Oct 21, 2016 6:29 pm
by dannyoorburg
But wouldn't it be so much more graceful to return a field with some sort of result code that has meaning within your application....

:)

Danny

Re: How to set a srvroutine in a "Failed" state programmatically

Posted: Fri Oct 21, 2016 6:42 pm
by dvanoni
It works using the "Abort" command!

Thanks a lot!