Hi all,
I'm working on a table update in perspective. I'm scripting in a "ondoubleclick" event. When the bit column edit happens, it does change in database but the table doesn't update until I click on another row.
I've tried with self.refreshBinding("props.data") as well as executing named query.
I've tried also to insert a delay of 2 secs before updating the table but the behaviour is the same.
I've found this post Perspective table strange behavior - Ignition - Inductive Automation Forum
where suggests to disable cache option. It is already disabled.
The code I have is the following. I've checked that the database is modified, and the response from named query shows that it does "run". But the update does not happen until I click on another row, no matter how many time I wait.
from time import sleep
if self.props.editingCell.column == 'status':
#Variables defining
Date= self.getSibling("DateTimeInput").props.value
Date= system.date.format(Date,'YYYY-MM-dd')
Cel = self.getSibling("Celula_Dropdown").props.value
Auditor = self.getSibling("Auditor_Dropdown").props.value
ID_Proyecto = self.props.data.getValueAt(self.props.editingCell.row,'id_proyecto')
Proyecto = self.props.data.getValueAt(self.props.editingCell.row,'proyecto')
Status_oldValue = event.value.status
Status_newValue = not Status_oldValue
#2. Check if value modified already exists in database
SQL_Check = "SOME SELECT QUERY "
AuditExists= system.db.runQuery(SQL_Check, 'BRC_IGNITION')
if len(AuditExists) == 1:
#Update Value
SQL_Update = "SOME UPDATE QUERY "
args =[Status_newValue,Auditor,ID_Proyecto,Date]
system.db.runPrepUpdate(SQL_Update, args, 'BRC_IGNITION')
self.refreshBinding("props.data")
#parameters = {"Cell":Cel, "fecha":Date}
#PyDataset = system.db.runNamedQuery("OPX_AuditsList", parameters)
#sleep(2)
#self.props.data = PyDataset
elif len(AuditExists) == 0:
#Insert value
SQL_Insert = "SOME INSERT QUERY "
args = [ID_Proyecto,Proyecto,Status_newValue,Date,Auditor]
system.db.runPrepUpdate(SQL_Insert,args,'BRC_IGNITION')
#sleep(2)
self.refreshBinding("props.data")
Do you have any suggestion? I guess is something easy, but I don't see it.