# Problem with If

**URL:** <https://forum.inductiveautomation.com/t/problem-with-if/41379>\
**Category:** Ignition\
**Created:** [December 10, 2020, 9:44am UTC](https://forum.inductiveautomation.com/t/problem-with-if/41379 "2020-12-10T09:44:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![etlikmilos](https://avatars.discourse-cdn.com/v4/letter/e/fbc32d/32.png) [@etlikmilos](https://forum.inductiveautomation.com/u/etlikmilos)\
**Post date:** [December 10, 2020, 9:44am UTC](https://forum.inductiveautomation.com/t/problem-with-if/41379/1 "2020-12-10T09:44:39Z")

</div>

Hi, all I need help with the error.  
I have the condition with If and I have an error but I don’t understand why.  
Can you help me.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/7/37273cd8acf9e20fc5aa551a879f97defd49ad27.png)

---

<div class="post-metadata">

**Author:** ![indenkleefj](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/indenkleefj/32/10961_2.png) [@indenkleefj](https://forum.inductiveautomation.com/u/indenkleefj)\
**Post date:** [December 10, 2020, 10:24am UTC](https://forum.inductiveautomation.com/t/problem-with-if/41379/2 "2020-12-10T10:24:34Z")

</div>

Hi,

It looks like your named query doesn’t return a row.  
This causes the data.getValueAt(0,0) to give the error because there is no row zero where he can find the value for column zero.  
What you need to do is first check if the data got more than 0 rows and if this is true you can get the value but when the data hasn’t any rows you need to create an else.  
So you need to do something like this:

```auto
if data.rowCount:
	if Atest and data.getValueAt(0,0) > "":
		pass
		#Do something
else:
	pass
	#Do something else

```
