# Issue with Automation - Using Loop (Data Point version 3.5)

**URL:** <https://forums.toadworld.com/t/issue-with-automation-using-loop-data-point-version-3-5/33338>\
**Category:** Toad Data Point & Toad Intelligence Central\
**Created:** [May 20, 2015, 11:15am UTC](https://forums.toadworld.com/t/issue-with-automation-using-loop-data-point-version-3-5/33338 "2015-05-20T11:15:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tennis\_champion](https://avatars.discourse-cdn.com/v4/letter/t/a698b9/32.png) [@tennis\_champion](https://forums.toadworld.com/u/tennis_champion)\
**Post date:** [May 20, 2015, 11:15am UTC](https://forums.toadworld.com/t/issue-with-automation-using-loop-data-point-version-3-5/33338/1 "2015-05-20T11:15:32Z")

</div>

Using [http://dev.toadfordataanalyst.com/webhelp/Content/Automation/Tutorials/Automate\_Loop\_Dataset.htm](http://dev.toadfordataanalyst.com/webhelp/Content/Automation/Tutorials/Automate_Loop_Dataset.htm) I have developed an Automation script using Loop .

the query in my Loop Dataset is the following:

select clientid, clientname from mlproduction.dbo.client where clientid in (10979,7187)

when I run the final automation Script with Select to File resulting Excel file contains data Clientid = 10979 but the name of the file (using #variable#) contains 7187.

Please advise.

thank you.

Best regards

---

<div class="post-metadata">

**Author:** ![Debbie\_Peabody](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/debbie_peabody/32/18_2.png) [@Debbie\_Peabody](https://forums.toadworld.com/u/Debbie_Peabody)\
**Post date:** [May 22, 2015, 2:56pm UTC](https://forums.toadworld.com/t/issue-with-automation-using-loop-data-point-version-3-5/33338/2 "2015-05-22T14:56:53Z")

</div>

Can you attach your automation script and automation log file? I would like to take a look.

Is the SelectToFile inside the loop? It sounds like it is outside. Here is another reference on how to build these types of scripts.

[www.toadworld.com/…/1133.aspx](http://www.toadworld.com/products/toad-data-point/m/media-library/1133.aspx)

---

<div class="post-metadata">

**Author:** ![tennis\_champion](https://avatars.discourse-cdn.com/v4/letter/t/a698b9/32.png) [@tennis\_champion](https://forums.toadworld.com/u/tennis_champion)\
**Post date:** [May 27, 2015, 10:17am UTC](https://forums.toadworld.com/t/issue-with-automation-using-loop-data-point-version-3-5/33338/3 "2015-05-27T10:17:42Z")

</div>

[View:~/cfs-file.ashx/\_\_key/communityserver-discussions-components-files/36/test\_5F00\_infotrieve.tas:550:0]

---

<div class="post-metadata">

**Author:** ![IgorM](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/igorm/32/116_2.png) [@IgorM](https://forums.toadworld.com/u/IgorM)\
**Post date:** [June 9, 2015, 2:57pm UTC](https://forums.toadworld.com/t/issue-with-automation-using-loop-data-point-version-3-5/33338/4 "2015-06-09T14:57:58Z")

</div>

You are using #client\_SQL# in the export file name of the File\_1 activity. client\_SQL is a SQL-type variable meaning its value is a result set. In case such variable is used ‘as is’ w/o specifying a column, the value of the 1st column in the 1st row is substituted. In your case it’s 10979.

To fix it, use #client\_SQL.clientid# in the export file name instead.

Igor.

---

<div class="post-metadata">

**Author:** ![tennis\_champion](https://avatars.discourse-cdn.com/v4/letter/t/a698b9/32.png) [@tennis\_champion](https://forums.toadworld.com/u/tennis_champion)\
**Post date:** [June 10, 2015, 7:47am UTC](https://forums.toadworld.com/t/issue-with-automation-using-loop-data-point-version-3-5/33338/5 "2015-06-10T07:47:28Z")

</div>

It worked. Thank you Igor.
