I am trying to create a tool that allows a user to update a table row without starting an edit session. I have a script tool set up with a record set parameter and I use this set up to add new rows to the table. It works well. What I would like to do now is load the record set parameter with the rows that will be edited. I am trying to do this in the updateParameters() method. However, when I load the parameter nothing happens in the dialog. I can see the record set in table of contents and its getting loaded but its as though the parameter is not updating.

Anyone had any success with something like this?

I have tried several ways to load the record set. My latest attempt is with a cursor. Here is the tool validation code for this latest attempt. I have three parameters, an input table view, an input record set, and an input string that I use for printing debug statements. The input record set has the schema imported from the table view I am trying to load.

import arcpy

def rows_as_dicts(cursor):
    colnames = cursor.fields
    for row in cursor:
        yield dict(zip(colnames, row))

def newRowFromDict(cursorFieldsTuple, inDict):
    newRow = []
    for field in cursorFieldsTuple:

    for item in inDict:
        newRowIndex = cursorFieldsTuple.index(item)
        newRow[newRowIndex] = inDict[item]
    return newRow

class ToolValidator(object):
  """Class for validating a tool's parameter values and controlling
  the behavior of the tool's dialog."""

  def __init__(self):
    """Setup arcpy and the list of tool parameters."""
    self.params = arcpy.GetParameterInfo()

  def initializeParameters(self):
    """Refine the properties of a tool's parameters.  This method is
    called when the tool is opened."""

  def updateParameters(self):
    """Modify the values and properties of parameters before internal
    validation is performed.  This method is called whenever a parmater
    has been changed."""
    pymsg,msgs = " No "," Problems"
    if self.params[0].altered and not self.params[0].hasBeenValidated:
        if not self.params[0].value == None:

            thetable = self.params[0].value
            recordSet = self.params[1].value
                inCur = arcpy.da.InsertCursor(recordSet, "*")
                inDict = dict.fromkeys(inCur.fields)
                inFields = inCur.fields

                searhcur = arcpy.da.SearchCursor(thetable, "*")
                searchDict = rows_as_dicts(searhcur)

                for row in searchDict:
                    for item in row:
                        if item in inFields:
                            inDict[item] = row[item]
                    newRow = newRowFromDict(inCur.fields, inDict)

                del inCur

                import sys
                import os
                import traceback    
                tb = sys.exc_info()[2]
                tbinfo = traceback.format_tb(tb)[0]
                pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1])
                msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages(2) + "\n"

            self.params[2].value = "Validation" + pymsg + msgs + " end"

  def updateMessages(self):
    """Modify the messages created by internal validation for each tool
    parameter.  This method is called after internal validation."""

closed as off-topic by PolyGeo Jul 19 '17 at 23:58

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This problem cannot or can no longer be reproduced. Changes to the system or to the asker's circumstances may have rendered the question obsolete, or the question does not include a procedure to enable potential answerers to reproduce the same symptoms. Such questions are off-topic as they are unlikely to help future readers, but editing them to include more details can lead to re-opening." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • After lots of back and forth with ESRI support it sounds like this is not possible as of 10.1 SP1. – TurboGus Dec 28 '12 at 21:26