mbfitts

SQL parameter doesn't show possible fields outside of MB editing session

Discussion created by mbfitts on Oct 29, 2013
Latest reply on Oct 30, 2013 by mbfitts
Hi,

I have a model that works fine, except that when it is run as a tool the SQL parameter does not show available fields. However, these fields are shown when it is being edited in model builder. All processing is taking place in a file geodatabase. This is not a huge problem for me, since I can change the expression in an edit session, save, and then run the tool. However, it would be nice to have to the tool work the way it's supposed to so that others can use it.

Here is my model:
[ATTACH=CONFIG]28709[/ATTACH]

And here is the python script as exported from model builder:
Input_Join_Field = arcpy.GetParameterAsText(7)
if Input_Join_Field == '#' or not Input_Join_Field:
    Input_Join_Field = "UNIT" # provide a default value if unspecified

SummaryStats1 = arcpy.GetParameterAsText(8)
if SummaryStats1 == '#' or not SummaryStats1:
    SummaryStats1 = "C:\\SEAC2013\\SEAC2013.gdb\\SummaryStats1" # provide a default value if unspecified

# Local variables:
QueryTable = Artifact_Type
QueryFeatureClass = QueryTable
QueryFeatureClass_Stats = QueryFeatureClass
Site_Feature_Layer = QueryFeatureClass_Stats
Site_Feature_Layer__2_ = Site_Feature_Layer

# Process: Make Query Table
arcpy.MakeQueryTable_management("C:\\SEAC2013\\SEAC2013.gdb\\Yk434CatalogPoly_;C:\\SEAC2013\\SEAC2013.gdb\\Yk434BurnBone_;C:\\SEAC2013\\SEAC2013.gdb\\Yk434_TestUnits", QueryTable, "ADD_VIRTUAL_KEY_FIELD", "", "", Expression)

# Process: Copy Features
arcpy.CopyFeatures_management(QueryTable, QueryFeatureClass, "", "0", "0", "0")

# Process: Summary Statistics
arcpy.Statistics_analysis(QueryFeatureClass, QueryFeatureClass_Stats, Statistics_Field_s_, Case_field)

# Process: Make Feature Layer
arcpy.MakeFeatureLayer_management(Site_Feature, Site_Feature_Layer, "", "", "OBJECTID_1 OBJECTID_1 VISIBLE NONE;Shape Shape VISIBLE NONE;OBJECTID OBJECTID VISIBLE NONE;ID ID VISIBLE NONE;STATUS STATUS VISIBLE NONE;UNIT UNIT VISIBLE NONE;SHAPE_Leng SHAPE_Leng VISIBLE NONE;Shape_Length Shape_Length VISIBLE NONE;Shape_Area Shape_Area VISIBLE NONE")

# Process: Add Join
arcpy.AddJoin_management(Site_Feature_Layer, Input_Join_Field, QueryFeatureClass_Stats, Output_Join_Field, "KEEP_ALL")

# Process: Copy Features (2)
arcpy.CopyFeatures_management(Site_Feature_Layer__2_, SummaryStats1, "", "0", "0", "0")


Am I missing a tool that creates a list of the available fields in the Make Query Table tool? Is there an environment setting that is causing this behavior? Any help will be most appreciated!

Attachments

Outcomes