Select to view content in your preferred language

Python Toolbox: Validating derived parameters for Model Builder

3222
1
07-07-2015 09:11 AM
YogiPatel
New Contributor II

I'm working on a tool in a Python toolbox and I'm running into trouble getting the output tables to work in Model Builder.

The tool takes an input table view and ultimately uses the Table Select (Analysis) tool to save two new tables, based on different SQL queries, into the geodatabase. I thought setting the Parameter Dependencies to the input table would be a good start, but that just set the output tables to updated versions of the input, not two new tables.

How I do validate Output table 1 and 2 so that they show up as two new tables in Model Builder but have all the fields of the input table?

def getParameterInfo(self):
        """Define parameter definitions"""
        workspace = arcpy.Parameter(
            displayName = "Geodatabase",
            name = "gdb",
            datatype = "DEWorkspace",
            parameterType = "Required",
            direction = "Input")
        workspace.defaultEnvironmentName = "workspace"

#     Input Table
 param1 = arcpy.Parameter(
            displayName = "Input Feature",
            name = "in_feature",
            datatype = "GPTableView",
            parameterType = "Required",
            direction = "Input"
            )

#      Output Table 1
        param7 = arcpy.Parameter(
            displayName = "GEOCODE Table",
            name = "geocode_table",
            datatype = "DETable",
            parameterType = "Derived",
            direction = "Output")

#      Output Table 2
        param8 = arcpy.Parameter(
            displayName = "FLAGGED Table",
            name = "flagged_table",
            datatype = "DETable",
            parameterType = "Derived",
            direction = "Output")

Please let me know if any additional information is required. I'm using 10.2.2 Advanced if that matters.

Tags (2)
0 Kudos
1 Reply
FreddieGibson
Regular Contributor II

Could you upload the logic for your dependencies. I would think that because you're creating new tables you would just assign the tables within the execution logic of your tool so that the new tables are returned to their needed parameter.

0 Kudos