# Problem with RunQuery and Retrieving Row Values

**URL:** <https://forum.inductiveautomation.com/t/problem-with-runquery-and-retrieving-row-values/20307>\
**Category:** Ignition\
**Created:** [October 22, 2018, 7:53pm UTC](https://forum.inductiveautomation.com/t/problem-with-runquery-and-retrieving-row-values/20307 "2018-10-22T19:53:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![micah.hastings](https://avatars.discourse-cdn.com/v4/letter/m/cc9497/32.png) [@micah.hastings](https://forum.inductiveautomation.com/u/micah.hastings)\
**Post date:** [October 22, 2018, 7:53pm UTC](https://forum.inductiveautomation.com/t/problem-with-runquery-and-retrieving-row-values/20307/1 "2018-10-22T19:53:10Z")

</div>

I’m trying to run a query inside a button ‘mouseClicked’ event. Below is the query I’m running with the results from SQL Management Studio. Also, I’ve attached a picture of the same query being run inside IGNITION. If I ask for the result at (0,0), I get the productname, but if I ask for the value at (0,1) or (0,2) then I get an error of 'can’t convert 0 to java.lang.String.  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/e/ef87afa634535a1b2e87e6e31d460d5d6e877538.png)

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/e/e90536fe24e9e7fe747953c4e9bb5039ac448fc2.png)  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/7/7cdf32f448cf1b403d92b90ec9201ddbc3036c98.png)

Any ideas on what I’m doing wrong? While I’m not new to programming, I am new to Python and Ignition.

---

<div class="post-metadata">

**Author:** ![JGJohnson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jgjohnson/32/29582_2.png) [@JGJohnson](https://forum.inductiveautomation.com/u/JGJohnson)\
**Post date:** [October 22, 2018, 8:00pm UTC](https://forum.inductiveautomation.com/t/problem-with-runquery-and-retrieving-row-values/20307/2 "2018-10-22T20:00:34Z")

</div>

It’s a data type issue. Convert to string and you’re set.

```auto
event.source.parent.getComponent("Result").text = str(result.getValueAt(0, 1))

```

---

<div class="post-metadata">

**Author:** ![micah.hastings](https://avatars.discourse-cdn.com/v4/letter/m/cc9497/32.png) [@micah.hastings](https://forum.inductiveautomation.com/u/micah.hastings)\
**Post date:** [October 22, 2018, 8:09pm UTC](https://forum.inductiveautomation.com/t/problem-with-runquery-and-retrieving-row-values/20307/3 "2018-10-22T20:09:48Z")

</div>

Thank you very much! I was trying toString(), String(), and everything in between except for that.

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [October 22, 2018, 8:36pm UTC](https://forum.inductiveautomation.com/t/problem-with-runquery-and-retrieving-row-values/20307/4 "2018-10-22T20:36:21Z")

</div>

You also do not need to use getValueAt on a resultset.  
You can just do str(result[0][1])
