I have a submit button that is taking the information I am putting into the Pass/Fail table and dumping it into a SQL database. but when I go back to the form the first names are still in the FirstName Column even though, the other columns are empty as they should be. Can someone tell me what I am doing wrong? I am including a screen shot along with code from the submit button. I am taking information from the left table and clicking/dragging to the right table.
Blockquote
data = event.source.parent.getComponent('PassFailTable').data
columnList = list(data.getColumnNames())
pyData = system.dataset.toPyDataSet(data)
t_stamp = system.date.now()
Create column string for the query
columnString = '(t_stamp,' + ','.join(columnList) + ')'
Create question marks for the prepQuery insert, adding one to each set of values for the timestamp
questionMarkString = ','.join(['(' + ','.join('?' * (len(columnList)+1)) + ')'] * len(pyData))
query = "INSERT INTO Quality.dbo.Defecting_WasteBeltAudits" + columnString + ' VALUES ' + questionMarkString
print query
Make a flat list out of the pyData
values =
for row in pyData:
# Add tStamp and row data for each row
values += [t_stamp]+list(row)
print values
system.db.runPrepUpdate(query, values)
tags = ["[Client]Defecting/Shift_1", "[Client]Defecting/Shift_2"]
Shift1values =[0,0]
system.tag.writeAll(tags,Shift1values)
table = event.source.parent.getComponent('PassFailTable')
dataIn = table.data
headers = list(dataIn.getColumnNames())
positionList = dataIn.getColumnAsList(0)
padding = len(headers)-1
dataOut =
for row in positionList:
newRow = [row] + [''] * padding
dataOut.append(newRow)
table.data = system.dataset.toDataSet(headers, dataOut)
window = system.nav.openWindow('Departments')
system.nav.centerWindow(window)
Blockquote