Problem with If

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.


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:

if data.rowCount:
	if Atest and data.getValueAt(0,0) > "":
		#Do something
	#Do something else
1 Like