Need to add a timestamp to each calibration entry. Should the timestamp orginate from Ignition or the DB? If ignition, how do I go about adding it to the query?
[code]tabledata=event.source.parent.getComponent(‘Table’).data
row = event.source.parent.getComponent(‘Table’).selectedRow
site = tabledata.getValueAt(row, “site”)
cal = tabledata.getValueAt(row, “calibration”)
t_stamp=system.db.dateFormat(now(),“yyyy-MM-dd HH:mm:ss”)
print site, cal
system.db.runPrepUpdate(“INSERT INTO pump_cal (site, calibration, t_stamp) VALUES (?,?,?)”,[site,cal,t_stamp])[/code]
Got it to work using this instead. Is this the correct way of entering the timestamp? Had to differentiate between expressions and scripts in order to get it to work.
tabledata=event.source.parent.getComponent('Table').data
row = event.source.parent.getComponent('Table').selectedRow
site = tabledata.getValueAt(row, "site")
cal = tabledata.getValueAt(row, "calibration")
t_stamp= event.source.parent.getComponent('datetime').text
print site, cal, t_stamp
system.db.runPrepUpdate("INSERT INTO pump_cal (site, calibration,t_stamp) VALUES (?,?,?)",[site,cal,t_stamp])