Insert value in power table at selected row in particular column

i have a power table and i want to insert a value at selected row at particular column.
i created one named query :
insert into [test]
values (GETDATE())
i want to insert this current date in particular one column at selected row.
i tried this script:
sel_row = event.source.parent.getComponent('Power Table').selectedRow
id = event.source.parent.getComponent('Power Table').data.getValueAt(sel_row, "complete_date")
system.db.runNamedQuery("complete task", {"complete_date":id})
event.source.parent.getComponent('Power Table').data = system.db.runNamedQuery("All_task_Query")

but values are updated in new row not at selected row.

You're using an INSERT statement. You need to use an UPDATE.

Also, it looks like you're trying to update the value of the row id? That's a bad idea. You should use an id in the row which is unique to that row and never changes.

UPDATE [test]
SET [complete_date] = GETDATE()
WHERE id = :id
1 Like

i tried this but value got update in every row, i want to update in particular selected row.

You need to use an ID in your query which is unique to the row you want to update. You will have issues otherwise. The UPDATE will update all rows which match the where clause.

Does your database table have a primary key?

thankyou, now its working