<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic SQL parameter doesn't show possible fields outside of MB editing session in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/sql-parameter-doesn-t-show-possible-fields-outside/m-p/500876#M39336</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my model:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]28709[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And here is the python script as exported from model builder:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
Input_Join_Field = arcpy.GetParameterAsText(7)
if Input_Join_Field == '#' or not Input_Join_Field:
&amp;nbsp;&amp;nbsp;&amp;nbsp; Input_Join_Field = "UNIT" # provide a default value if unspecified

SummaryStats1 = arcpy.GetParameterAsText(8)
if SummaryStats1 == '#' or not SummaryStats1:
&amp;nbsp;&amp;nbsp;&amp;nbsp; 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")
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Oct 2013 01:24:05 GMT</pubDate>
    <dc:creator>MaryFitts</dc:creator>
    <dc:date>2013-10-30T01:24:05Z</dc:date>
    <item>
      <title>SQL parameter doesn't show possible fields outside of MB editing session</title>
      <link>https://community.esri.com/t5/python-questions/sql-parameter-doesn-t-show-possible-fields-outside/m-p/500876#M39336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my model:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]28709[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And here is the python script as exported from model builder:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
Input_Join_Field = arcpy.GetParameterAsText(7)
if Input_Join_Field == '#' or not Input_Join_Field:
&amp;nbsp;&amp;nbsp;&amp;nbsp; Input_Join_Field = "UNIT" # provide a default value if unspecified

SummaryStats1 = arcpy.GetParameterAsText(8)
if SummaryStats1 == '#' or not SummaryStats1:
&amp;nbsp;&amp;nbsp;&amp;nbsp; 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")
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Oct 2013 01:24:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sql-parameter-doesn-t-show-possible-fields-outside/m-p/500876#M39336</guid>
      <dc:creator>MaryFitts</dc:creator>
      <dc:date>2013-10-30T01:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: SQL parameter doesn't show possible fields outside of MB editing session</title>
      <link>https://community.esri.com/t5/python-questions/sql-parameter-doesn-t-show-possible-fields-outside/m-p/500877#M39337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I realized that there should not be quotes in the SQL expression for Make Query Table to work correctly, but this does not change the behavior of the model when "opened" as a tool. The available fields for the SQL expression are visible in a model editing session, but not when the model is "opened". All the other parameters show available options correctly in both contexts.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there any other information I can provide that would help solve this problem?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Mary Beth&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Oct 2013 12:57:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sql-parameter-doesn-t-show-possible-fields-outside/m-p/500877#M39337</guid>
      <dc:creator>MaryFitts</dc:creator>
      <dc:date>2013-10-30T12:57:08Z</dc:date>
    </item>
  </channel>
</rss>

