Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
2 posts Page 1 of 1


User avatar
Verified User
Posts: 4
Joined: Fri Jun 05, 2009 11:38 am
Location: USA

Post by a_houston » Thu Oct 20, 2011 9:58 am
I am trying to get a record count from a file using a query and SetVariable task. I am using a simple record count as shown below:

<sql label="Connect to DB" resourceId="LOCAL" version="1.0">
<query label="Select Data" outputVariable="records">
<statement>Select count(*) From filelib.testfile </statement> </query>

I then add a SetVariable task and my system places the following in the XML:

<setVariable name="foundcount" value="${records[1]}" version="2.0"

When I run the project I get the following error:

[8099 - setVariable] An unexpected error occurred. Cursor position not valid.

If I change the SetVariable statement to version 1.0 as shown below, it works correctly

<setVariable name="foundcount" value="${records[1]}" version="1.0" />

I have been unable to find anything that tells me what the correct syntax is for Version 2.0


Support Specialist
Posts: 66
Joined: Thu Mar 05, 2009 3:49 pm

Post by Support_Duane » Thu Oct 20, 2011 11:43 am
There are two versions of the SetVariable task. You can use the SetVariable Version 1 task anywhere but it will only get data from the first row of the rowset or fileset. If you want to loop thru the rows of a rowset or filest, you need to use the SetVariable version 2 task. If you are just changing the value of a variable, then either version of the task can be used anywhere within GoAnywhere Director.

In your case, you need to change <setVariable name="foundcount" value="${records[1]}" version="2.0" to <setVariable name="foundcount" value="${records[1]}" version="1.0"
2 posts Page 1 of 1