I have a power table that runs a script onCellEdited. It updates the db and refreshes the data in the table to reflect the change. Next it sends an email out to notify someone of the change, then finally it logs the change in a db table. I have code on another table that is identical to this, except it edits a different db table and it works perfectly. This table however will not send the email or log the change in the db. I’ve looked over it for 2 hours and cannot figure out why it fails. The weird thing is there is no error messages that pops up, it just quits at the email portion. I know for a fact that it stops at the email portion and not before. I will have a java error message box that will show up minimized every so often, but when I try view the error nothing shows up???
import system
import datetime
if self.parent.getComponent('EditButton').selected == 1:
self.data = system.dataset.setValue(self.data, rowIndex, colIndex, newValue)
if newValue == oldValue:
return
else:
ndx = self.data.getValueAt(rowIndex,0)
system.db.runPrepUpdate("UPDATE mill_programcodes SET %s=? WHERE mill_programcodes_ndx=?"% colName, [newValue,ndx])
system.db.refresh(self,"data")
style = self.data.getValueAt(rowIndex, 'style')
system.gui.messageBox('It got this far')
smtp = "xxx.xxx.com"
sender = "xxx@xxx.com"
subject = "Millroom Program Edit"
body = "<HTML>There has been an edit to Millroom Program Database.<br/> Style Edited: "+ style + "<br/>Column Edited: "+colName+"<br/> New Value:" + newValue + "<br/> Old Value:" + oldValue + "</HTML>"
recipients = [ xxxxx emails]
system.net.sendEmail(smtp, sender, subject, body, 1, recipients)
action = "Change At: "+ colName + ' Old: ' + oldValue + ' New: ' +newValue
user = system.tag.read("[System]Client/User/Username").value
time = datetime.datetime.now()
system.db.runNamedQuery('Styles/LogChange', {'action':action, 'user':user, 'time':time, 'style':style})
else: system.gui.warningBox('<font size = 20>Not in edit mode</font>')