JLuymes

Insert Cursor Issue

Discussion created by JLuymes on Jan 27, 2012
Latest reply on Jan 27, 2012 by mdenil
Hi,

The following code seems like it should work. I'm writing a script to check for certain values in a layer and then write them to a table.

All I get from running this is a blank output table. that has rows populated but no records. Any help?

gp.createtable (gp.Workspace, "table")
tablelink = gp.Workspace + os.sep + "table"
gp.addfield(tablelink, "Error","text","30")
gp.addfield(tablelink, "RMOHID","double")

Msg("Checking water mains")
wms = "watmainselect"
gp.select(wm,wms,exp)
wmlist = ["MATERIAL","PIPEDIAMETER","STREET","MEASUREDLENGTH","TCAChangeType","TCAChangeDate"]
in_rows = gp.InsertCursor(tablelink)
cur = gp.UpdateCursor(wms)
row = cur.Next()
while row:
    for i in wmlist:
        in_row = in_rows.NewRow()
        in_row.Name = i
        in_row.RMOHID = row.RMOHID
        in_rows.InsertRow(in_row)
    row = cur.Next()
del cur, row, in_rows

Outcomes