Skip to content

OnError for SQL Task.

Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
  • LPrendergast Offline
  • Verified User
  • Posts: 14
  • Joined: Tue May 26, 2009 8:54 am

OnError for SQL Task.

Post by LPrendergast »

Hi, Iam trying to set a variable in the the onerror event of the SQL query task. BUt i cant seem to get the syntax right. I have a variable cslled GetFile and I want to set it to FAIL if any error occurs. But I cant figure out how to set the varible correctly, instead I get the following error:

[8003 - sql] Invalid value 'setVariable:[GetFile]=['FAIL']' for attribute 'onError' in element 'sql'


I think I tried every possible way of formating it with no luck.
  • Support_Rick Offline
  • Support Specialist
  • Posts: 590
  • Joined: Tue Jul 17, 2012 2:12 pm
  • Location: Phoenix, AZ
  • Contact:

Re: OnError for SQL Task.

Post by Support_Rick »

LP,

Use the following syntax:

Code: Select all

<setVariable label="Set sqlError" name="sqlError" value="0" version="1.0" />
<sql label="Connect to Server" resourceId="${ JobServer }" version="1.0" onError="setVariable:sqlError=1">
You can set the values to whatever you want. I normally use 0 for "it worked" and numbers greater than 0 for "it didn't"
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
  • LPrendergast Offline
  • Verified User
  • Posts: 14
  • Joined: Tue May 26, 2009 8:54 am

Re: OnError for SQL Task.

Post by LPrendergast »

Rick, that worked by switching to 0 or 1. But I would still like to know how to pass a character string. Is tha possible?
  • Support_Rick Offline
  • Support Specialist
  • Posts: 590
  • Joined: Tue Jul 17, 2012 2:12 pm
  • Location: Phoenix, AZ
  • Contact:

Re: OnError for SQL Task.

Post by Support_Rick »

LP,

Try something like this:

Code: Select all

<project name="TestThis" mainModule="Main" version="2.0">

	<module name="Main">

		<setVariable label="Init Error Var" name="MyError" value="YepItWorked" version="2.0" />
		<sftp resourceId="Ricks Laptop sFTP" version="1.0" onError="setVariable:MyError=NopeItDidntWork">
			<put sourceFile="C:\Program Files\Linoma Software\GoAnywhere\userdata\keys\x509\gadirector-sample.p13" destinationDir="\" />
		</sftp>

		<print version="1.0">
			<![CDATA[
====================

Error:  ${MyError}

====================]]>
		</print>

	</module>

</project>
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
Post Reply