Page 1 of 1
OnError for SQL Task.
Posted: Wed Mar 13, 2013 5:13 pm
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.
Re: OnError for SQL Task.
Posted: Wed Mar 13, 2013 6:20 pm
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"
Re: OnError for SQL Task.
Posted: Thu Mar 14, 2013 5:18 pm
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?
Re: OnError for SQL Task.
Posted: Fri Mar 15, 2013 8:09 am
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>