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

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
dvanoni
Posts: 37
Joined: Wed Dec 02, 2015 3:47 am
Location: Chiasso - Switzerland

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

Post 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
User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

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

Post by Stewart Marshall »

Dividing by zero works nicely too
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au
dannyoorburg
Posts: 177
Joined: Mon Jan 04, 2016 9:50 am
Location: Australia

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

Post 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
dvanoni
Posts: 37
Joined: Wed Dec 02, 2015 3:47 am
Location: Chiasso - Switzerland

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

Post by dvanoni »

It works using the "Abort" command!

Thanks a lot!
Post Reply