I have a table component our operators use to enter in their end of shift totals.
They sometimes need to change either the start Time or end time. These are automatically stored as DateTime in this MySQL database. On the Table component these columns are displayed only as HH:mm in the db table they are “yyyy-MM-dd HH:mm:ss”. When they make a change the db table is updated as “1970-01-01 HH:mm:ss”. How do I get this Table Component chnage to update my db table with the correct date instead of the default 1970-01-01?
I am currently using the Table Component Scripting cellEdited to update these entries.
Script is below.
row = event.row
col = event.column
colName = event.source.data.getColumnName(col)
value = event.newValue
ndx = event.source.data.getValueAt(row,0)
query = "Update canfill SET %s = ? WHERE ndx = ?"
system.db.runPrepUpdate(query % colName, [value,ndx], 'history')