# Power table update issue

**URL:** <https://forum.inductiveautomation.com/t/power-table-update-issue/39584>\
**Category:** Ignition\
**Tags:** scripting, database, ignition80\
**Created:** [October 12, 2020, 2:13am UTC](https://forum.inductiveautomation.com/t/power-table-update-issue/39584 "2020-10-12T02:13:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yifeiliu08](https://avatars.discourse-cdn.com/v4/letter/y/bbe5ce/32.png) [@yifeiliu08](https://forum.inductiveautomation.com/u/yifeiliu08)\
**Post date:** [October 12, 2020, 2:13am UTC](https://forum.inductiveautomation.com/t/power-table-update-issue/39584/1 "2020-10-12T02:13:55Z")

</div>

My ignition current version is 8.1.0RC1  
In my version module power table I have 2 issue:  
Problem 1:

```auto
if system.gui.confirm(u'记录将删除， 请确认？'):
	RequestDateTime=event.source.parent.getComponent('Power Table').RequestDateTime

	query="""
	DELETE FROM [dbo].[NTCOATest]
		  WHERE RequestDateTime=?
	"""
	system.db.runPrepUpdate(query,[RequestDateTime],'NTLog')
	
	table=event.source.parent.getComponent("Power Table")
	system.db.refresh(table,"data")

```

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/f/0f6d93a61fa2d4155cf21c40fc880e0dc57223d6.png)  
Here is the time what I get

```auto
SELECT 
       [WO_ID]
     , [RequestDateTime]
 

  FROM [NTLog].[dbo].[NTCOATest]
  WHERE RequestDate>='{Root Container.From.selectedLabel}'
  AND RequestDate<='{Root Container.To.selectedLabel}'
  ORDER BY WO_ID

```

Before 8.1.0RC1 , I can make this logic work, but after update to 8.1.0RC1 , I found it can’t work , due to the date format is changed, my question is in 8.1 version , if I have a datetime in the SQL table, if I want to update the query based on it’s timestamp, how to scripting ?

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

Problem 2:

```auto
	import system	
	id = self.data.getValueAt(rowIndex, "WO_ID")	
	query = "UPDATE [dbo].[NTCOATest] SET %s = ? WHERE [WO_ID] = ?" % (colName)
	args = [newValue, id]
	system.db.runPrepUpdate(query, args, 'NTLog')
	system.db.refresh(self, "data")

```

I have a table I scripting is able to update base on the upside logic

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/5/95bd025e3fd46e982adadb5955aa95dad2ddd666.png)  
when I click the null column and do no change, then I click other column,  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/f/dfd36930b850def3da86f46963a81c4ca66c6ab7.png)  
this null value will update to 0 ,how to avoid these problem happen?

thanks a lot
