<?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 How to get fields from GPValueTable feature classes in UpdateParamters function, arcpy.Describe throws error while we input model builder variable(which is out put from other tool) in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-get-fields-from-gpvaluetable-feature/m-p/11309#M931</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Below is the sample code which throws error when used in model builder and set input from other tool&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;class &lt;/SPAN&gt;CombinedTool(&lt;SPAN style="color: #000080;"&gt;object&lt;/SPAN&gt;):
    &lt;SPAN style="color: #000080; font-weight: bold;"&gt;def &lt;/SPAN&gt;&lt;SPAN style="color: #b200b2;"&gt;__init__&lt;/SPAN&gt;(&lt;SPAN style="color: #94558d;"&gt;self&lt;/SPAN&gt;):
        &lt;SPAN style="color: #808080;"&gt;"""Define the tool (tool name is the name of the class)."""
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;        &lt;/SPAN&gt;&lt;SPAN style="color: #94558d;"&gt;self&lt;/SPAN&gt;.label = &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"CombinedLRTool"
&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;        &lt;/SPAN&gt;&lt;SPAN style="color: #94558d;"&gt;self&lt;/SPAN&gt;.description = &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"CombinedTool"
&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;        &lt;/SPAN&gt;&lt;SPAN style="color: #94558d;"&gt;self&lt;/SPAN&gt;.canRunInBackground = &lt;SPAN style="color: #000080;"&gt;False
&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;        &lt;/SPAN&gt;&lt;SPAN style="color: #94558d;"&gt;self&lt;/SPAN&gt;.params = arcpy.GetParameterInfo()
    &lt;SPAN style="color: #000080; font-weight: bold;"&gt;def &lt;/SPAN&gt;getParameterInfo(&lt;SPAN style="color: #94558d;"&gt;self&lt;/SPAN&gt;):
        &lt;SPAN style="color: #808080;"&gt;"""Define parameter definitions"""
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;        &lt;/SPAN&gt;in_tables = arcpy.Parameter(
            &lt;SPAN style="color: #660099;"&gt;displayName&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"Input Layers"&lt;/SPAN&gt;,
            &lt;SPAN style="color: #660099;"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"InputLayers"&lt;/SPAN&gt;,
            &lt;SPAN style="color: #660099;"&gt;datatype&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"GPFeatureLayer"&lt;/SPAN&gt;,
            &lt;SPAN style="color: #660099;"&gt;parameterType&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"Required"&lt;/SPAN&gt;,
            &lt;SPAN style="color: #660099;"&gt;direction&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"Input"&lt;/SPAN&gt;)

        in_seg = arcpy.Parameter(
            &lt;SPAN style="color: #660099;"&gt;displayName&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"Seg Layers"&lt;/SPAN&gt;,
            &lt;SPAN style="color: #660099;"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"in_seg"&lt;/SPAN&gt;,
            &lt;SPAN style="color: #660099;"&gt;datatype&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"GPValueTable"&lt;/SPAN&gt;,
            &lt;SPAN style="color: #808080;"&gt;# parameterType="Optional",
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;            &lt;/SPAN&gt;&lt;SPAN style="color: #660099;"&gt;direction&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"Input"&lt;/SPAN&gt;)
        in_seg.columns = [[&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"GPTableView"&lt;/SPAN&gt;, &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"layer"&lt;/SPAN&gt;]]

        testvalue = arcpy.Parameter(
            &lt;SPAN style="color: #660099;"&gt;displayName&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"Test Field"&lt;/SPAN&gt;,
            &lt;SPAN style="color: #660099;"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"testvalue"&lt;/SPAN&gt;,
            &lt;SPAN style="color: #660099;"&gt;datatype&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"GPString"&lt;/SPAN&gt;,
            &lt;SPAN style="color: #660099;"&gt;direction&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"Input"&lt;/SPAN&gt;)

        params = [in_tables,in_seg,testvalue]
        &lt;SPAN style="color: #000080; font-weight: bold;"&gt;return &lt;/SPAN&gt;params

    &lt;SPAN style="color: #000080; font-weight: bold;"&gt;def &lt;/SPAN&gt;isLicensed(&lt;SPAN style="color: #94558d;"&gt;self&lt;/SPAN&gt;):
        &lt;SPAN style="color: #808080;"&gt;"""Set whether tool is licensed to execute."""
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;        &lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;return &lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;True
&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;    &lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;def &lt;/SPAN&gt;updateParameters(&lt;SPAN style="color: #94558d;"&gt;self&lt;/SPAN&gt;, parameters):
        &lt;SPAN style="color: #808080;"&gt;"""Modify the values and properties of parameters before internal
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;        validation is performed.  This method is called whenever a parameter
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;        has been changed."""        
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;        &lt;/SPAN&gt;lyrdscr = arcpy.Describe(parameters[&lt;SPAN style="color: #0000ff;"&gt;1&lt;/SPAN&gt;].value[&lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;][&lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;])
        parameters[&lt;SPAN style="color: #0000ff;"&gt;2&lt;/SPAN&gt;].value = &lt;SPAN style="color: #000080;"&gt;str&lt;/SPAN&gt;([f.name &lt;SPAN style="color: #000080; font-weight: bold;"&gt;for &lt;/SPAN&gt;f &lt;SPAN style="color: #000080; font-weight: bold;"&gt;in &lt;/SPAN&gt;lyrdscr.fields])        

        &lt;SPAN style="color: #000080; font-weight: bold;"&gt;return
&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;    def &lt;/SPAN&gt;updateMessages(&lt;SPAN style="color: #94558d;"&gt;self&lt;/SPAN&gt;, parameters):
        &lt;SPAN style="color: #808080;"&gt;"""Modify the messages created by internal validation for each tool
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;        parameter.  This method is called after internal validation."""
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;        &lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;return
&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;    def &lt;/SPAN&gt;execute(&lt;SPAN style="color: #94558d;"&gt;self&lt;/SPAN&gt;, parameters, messages):


        &lt;SPAN style="color: #000080; font-weight: bold;"&gt;return&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 20:29:13 GMT</pubDate>
    <dc:creator>SivaSontineni</dc:creator>
    <dc:date>2021-12-10T20:29:13Z</dc:date>
    <item>
      <title>How to get fields from GPValueTable feature classes in UpdateParamters function, arcpy.Describe throws error while we input model builder variable(which is out put from other tool)</title>
      <link>https://community.esri.com/t5/python-questions/how-to-get-fields-from-gpvaluetable-feature/m-p/11309#M931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Below is the sample code which throws error when used in model builder and set input from other tool&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;class &lt;/SPAN&gt;CombinedTool(&lt;SPAN style="color: #000080;"&gt;object&lt;/SPAN&gt;):
    &lt;SPAN style="color: #000080; font-weight: bold;"&gt;def &lt;/SPAN&gt;&lt;SPAN style="color: #b200b2;"&gt;__init__&lt;/SPAN&gt;(&lt;SPAN style="color: #94558d;"&gt;self&lt;/SPAN&gt;):
        &lt;SPAN style="color: #808080;"&gt;"""Define the tool (tool name is the name of the class)."""
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;        &lt;/SPAN&gt;&lt;SPAN style="color: #94558d;"&gt;self&lt;/SPAN&gt;.label = &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"CombinedLRTool"
&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;        &lt;/SPAN&gt;&lt;SPAN style="color: #94558d;"&gt;self&lt;/SPAN&gt;.description = &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"CombinedTool"
&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;        &lt;/SPAN&gt;&lt;SPAN style="color: #94558d;"&gt;self&lt;/SPAN&gt;.canRunInBackground = &lt;SPAN style="color: #000080;"&gt;False
&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;        &lt;/SPAN&gt;&lt;SPAN style="color: #94558d;"&gt;self&lt;/SPAN&gt;.params = arcpy.GetParameterInfo()
    &lt;SPAN style="color: #000080; font-weight: bold;"&gt;def &lt;/SPAN&gt;getParameterInfo(&lt;SPAN style="color: #94558d;"&gt;self&lt;/SPAN&gt;):
        &lt;SPAN style="color: #808080;"&gt;"""Define parameter definitions"""
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;        &lt;/SPAN&gt;in_tables = arcpy.Parameter(
            &lt;SPAN style="color: #660099;"&gt;displayName&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"Input Layers"&lt;/SPAN&gt;,
            &lt;SPAN style="color: #660099;"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"InputLayers"&lt;/SPAN&gt;,
            &lt;SPAN style="color: #660099;"&gt;datatype&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"GPFeatureLayer"&lt;/SPAN&gt;,
            &lt;SPAN style="color: #660099;"&gt;parameterType&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"Required"&lt;/SPAN&gt;,
            &lt;SPAN style="color: #660099;"&gt;direction&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"Input"&lt;/SPAN&gt;)

        in_seg = arcpy.Parameter(
            &lt;SPAN style="color: #660099;"&gt;displayName&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"Seg Layers"&lt;/SPAN&gt;,
            &lt;SPAN style="color: #660099;"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"in_seg"&lt;/SPAN&gt;,
            &lt;SPAN style="color: #660099;"&gt;datatype&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"GPValueTable"&lt;/SPAN&gt;,
            &lt;SPAN style="color: #808080;"&gt;# parameterType="Optional",
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;            &lt;/SPAN&gt;&lt;SPAN style="color: #660099;"&gt;direction&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"Input"&lt;/SPAN&gt;)
        in_seg.columns = [[&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"GPTableView"&lt;/SPAN&gt;, &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"layer"&lt;/SPAN&gt;]]

        testvalue = arcpy.Parameter(
            &lt;SPAN style="color: #660099;"&gt;displayName&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"Test Field"&lt;/SPAN&gt;,
            &lt;SPAN style="color: #660099;"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"testvalue"&lt;/SPAN&gt;,
            &lt;SPAN style="color: #660099;"&gt;datatype&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"GPString"&lt;/SPAN&gt;,
            &lt;SPAN style="color: #660099;"&gt;direction&lt;/SPAN&gt;=&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"Input"&lt;/SPAN&gt;)

        params = [in_tables,in_seg,testvalue]
        &lt;SPAN style="color: #000080; font-weight: bold;"&gt;return &lt;/SPAN&gt;params

    &lt;SPAN style="color: #000080; font-weight: bold;"&gt;def &lt;/SPAN&gt;isLicensed(&lt;SPAN style="color: #94558d;"&gt;self&lt;/SPAN&gt;):
        &lt;SPAN style="color: #808080;"&gt;"""Set whether tool is licensed to execute."""
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;        &lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;return &lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;True
&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;    &lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;def &lt;/SPAN&gt;updateParameters(&lt;SPAN style="color: #94558d;"&gt;self&lt;/SPAN&gt;, parameters):
        &lt;SPAN style="color: #808080;"&gt;"""Modify the values and properties of parameters before internal
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;        validation is performed.  This method is called whenever a parameter
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;        has been changed."""        
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;        &lt;/SPAN&gt;lyrdscr = arcpy.Describe(parameters[&lt;SPAN style="color: #0000ff;"&gt;1&lt;/SPAN&gt;].value[&lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;][&lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;])
        parameters[&lt;SPAN style="color: #0000ff;"&gt;2&lt;/SPAN&gt;].value = &lt;SPAN style="color: #000080;"&gt;str&lt;/SPAN&gt;([f.name &lt;SPAN style="color: #000080; font-weight: bold;"&gt;for &lt;/SPAN&gt;f &lt;SPAN style="color: #000080; font-weight: bold;"&gt;in &lt;/SPAN&gt;lyrdscr.fields])        

        &lt;SPAN style="color: #000080; font-weight: bold;"&gt;return
&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;    def &lt;/SPAN&gt;updateMessages(&lt;SPAN style="color: #94558d;"&gt;self&lt;/SPAN&gt;, parameters):
        &lt;SPAN style="color: #808080;"&gt;"""Modify the messages created by internal validation for each tool
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;        parameter.  This method is called after internal validation."""
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;        &lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;return
&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;    def &lt;/SPAN&gt;execute(&lt;SPAN style="color: #94558d;"&gt;self&lt;/SPAN&gt;, parameters, messages):


        &lt;SPAN style="color: #000080; font-weight: bold;"&gt;return&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:29:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-get-fields-from-gpvaluetable-feature/m-p/11309#M931</guid>
      <dc:creator>SivaSontineni</dc:creator>
      <dc:date>2021-12-10T20:29:13Z</dc:date>
    </item>
  </channel>
</rss>

