<?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 Printing Field name Using Search Cursor on a Joined Field in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/printing-field-name-using-search-cursor-on-a/m-p/178306#M13695</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to print out the values in a field using a cursor search on a field which I have have joined. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have created a field list and printed it, and i get all the indexed field names, (i.e. SO_SOIL_P.SITE) which is great, but when I try to use the field name when I print the row's value in a cursor search, it's telling me the field doesn't exist. I think it's the processor is having troubles handling the 2 periods in the field ID for the row (i.e. row.SO_SOIL_P.SITE), but it also doesn't like row.SITE. Can anyone suggest a way to write this line to have the values returned properly? Please see the comments at the bottom of the script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy from arcpy import env&amp;nbsp; env.overwriteOutput = True&amp;nbsp; # Local variables: SOIL_P_TERR_Spatial = "Z:\\ESRI\\Geodatabase\\Test1.gdb\\SOIL_P_TERR_Spatial" SO_SOILSCHEM_T = "Z:\\ESRI\\Geodatabase\\Test1.gdb\\SO_SOILSCHEM_T" SO_SOIL_P = "Z:\\ESRI\\Geodatabase\\Test1.gdb\\SO_SOIL_P" v_smu = "\"smu\"" v_spatial_ = "\"spatial\"" soiltable = "soiltable" v_smu2 = "\"smu\""&amp;nbsp;&amp;nbsp; arcpy.AddIndex_management(SO_SOIL_P, "SITE;SITE_ID;LOCATION;LSD", "SO_SOIL_P_index", "NON_UNIQUE", "ASCENDING")&amp;nbsp; # Process: Make Feature Layer arcpy.MakeFeatureLayer_management(SO_SOIL_P, v_smu)&amp;nbsp; # Process: Add Join arcpy.AddJoin_management(v_smu, "SITE_ID", v_spatial_, "SITE_ID", "KEEP_ALL")&amp;nbsp; # Process: Make Table View arcpy.MakeTableView_management(SO_SOILSCHEM_T, soiltable)&amp;nbsp; # Process: Add Join (2) jointables = arcpy.AddJoin_management(v_smu2, "SO_SOIL_P.SITE_ID", soiltable, "SITE_ID", "KEEP_ALL")&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldList = arcpy.ListFields(jointables)&amp;nbsp; # This prints all the fields in the above joins successfully. for field in fieldList: &amp;nbsp;&amp;nbsp;&amp;nbsp; print field.name &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows = arcpy.SearchCursor(jointables)&amp;nbsp; for row in rows: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # This will print the unicode row &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print row &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # This print will error out, saying the field doesn't exist, but in the field list about, it does &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print row.SO_SOIL_P.OBJECTID &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # I get the same error when I try this as well &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print row.OBJECTID&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 06 Feb 2012 19:37:50 GMT</pubDate>
    <dc:creator>MikeMacRae</dc:creator>
    <dc:date>2012-02-06T19:37:50Z</dc:date>
    <item>
      <title>Printing Field name Using Search Cursor on a Joined Field</title>
      <link>https://community.esri.com/t5/python-questions/printing-field-name-using-search-cursor-on-a/m-p/178306#M13695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to print out the values in a field using a cursor search on a field which I have have joined. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have created a field list and printed it, and i get all the indexed field names, (i.e. SO_SOIL_P.SITE) which is great, but when I try to use the field name when I print the row's value in a cursor search, it's telling me the field doesn't exist. I think it's the processor is having troubles handling the 2 periods in the field ID for the row (i.e. row.SO_SOIL_P.SITE), but it also doesn't like row.SITE. Can anyone suggest a way to write this line to have the values returned properly? Please see the comments at the bottom of the script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy from arcpy import env&amp;nbsp; env.overwriteOutput = True&amp;nbsp; # Local variables: SOIL_P_TERR_Spatial = "Z:\\ESRI\\Geodatabase\\Test1.gdb\\SOIL_P_TERR_Spatial" SO_SOILSCHEM_T = "Z:\\ESRI\\Geodatabase\\Test1.gdb\\SO_SOILSCHEM_T" SO_SOIL_P = "Z:\\ESRI\\Geodatabase\\Test1.gdb\\SO_SOIL_P" v_smu = "\"smu\"" v_spatial_ = "\"spatial\"" soiltable = "soiltable" v_smu2 = "\"smu\""&amp;nbsp;&amp;nbsp; arcpy.AddIndex_management(SO_SOIL_P, "SITE;SITE_ID;LOCATION;LSD", "SO_SOIL_P_index", "NON_UNIQUE", "ASCENDING")&amp;nbsp; # Process: Make Feature Layer arcpy.MakeFeatureLayer_management(SO_SOIL_P, v_smu)&amp;nbsp; # Process: Add Join arcpy.AddJoin_management(v_smu, "SITE_ID", v_spatial_, "SITE_ID", "KEEP_ALL")&amp;nbsp; # Process: Make Table View arcpy.MakeTableView_management(SO_SOILSCHEM_T, soiltable)&amp;nbsp; # Process: Add Join (2) jointables = arcpy.AddJoin_management(v_smu2, "SO_SOIL_P.SITE_ID", soiltable, "SITE_ID", "KEEP_ALL")&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldList = arcpy.ListFields(jointables)&amp;nbsp; # This prints all the fields in the above joins successfully. for field in fieldList: &amp;nbsp;&amp;nbsp;&amp;nbsp; print field.name &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows = arcpy.SearchCursor(jointables)&amp;nbsp; for row in rows: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # This will print the unicode row &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print row &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # This print will error out, saying the field doesn't exist, but in the field list about, it does &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print row.SO_SOIL_P.OBJECTID &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # I get the same error when I try this as well &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print row.OBJECTID&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 19:37:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/printing-field-name-using-search-cursor-on-a/m-p/178306#M13695</guid>
      <dc:creator>MikeMacRae</dc:creator>
      <dc:date>2012-02-06T19:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: Printing Field name Using Search Cursor on a Joined Field</title>
      <link>https://community.esri.com/t5/python-questions/printing-field-name-using-search-cursor-on-a/m-p/178307#M13696</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try row.getValue("SO_SOIL_P.OBJECTID") instead. You could also use a variable instead of a string literal, i.e. row.getValue(fieldName), where fieldName is a variable assigned previously.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 20:14:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/printing-field-name-using-search-cursor-on-a/m-p/178307#M13696</guid>
      <dc:creator>LoganPugh</dc:creator>
      <dc:date>2012-02-06T20:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: Printing Field name Using Search Cursor on a Joined Field</title>
      <link>https://community.esri.com/t5/python-questions/printing-field-name-using-search-cursor-on-a/m-p/178308#M13697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey thanks for the response Logan.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tested this, and row.Getvalue works on the parent table table (SO_SOIL_P), but only when you script it as follows (e.g. without the table heading. It won't work with the table heading included):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;print row.getValue("OBJECTID")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I try to pull values from a field in one of the joined tables it errors out again using either of the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;print row.getValue("SITE_ID")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;print row.getValue("SO_SOILSCHEM_T.SITE_ID)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure if it can recognize the double join?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 20:40:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/printing-field-name-using-search-cursor-on-a/m-p/178308#M13697</guid>
      <dc:creator>MikeMacRae</dc:creator>
      <dc:date>2012-02-06T20:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: Printing Field name Using Search Cursor on a Joined Field</title>
      <link>https://community.esri.com/t5/python-questions/printing-field-name-using-search-cursor-on-a/m-p/178309#M13698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Not sure what to tell ya, it works for me:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;gt;&amp;gt;&amp;gt; fc = r"C:\Program Files\ArcGIS\DeveloperKit10.0\Samples\data\SanFrancisco\SanFrancisco.gdb\Transportation\Streets" &amp;gt;&amp;gt;&amp;gt; table = r"C:\Program Files\ArcGIS\DeveloperKit10.0\Samples\data\SanFrancisco\SanFrancisco.gdb\Streets_DailyProfiles" &amp;gt;&amp;gt;&amp;gt; featLyr = arcpy.MakeFeatureLayer_management(fc) &amp;gt;&amp;gt;&amp;gt; tblView = arcpy.MakeTableView_management(table) &amp;gt;&amp;gt;&amp;gt; arcpy.AddJoin_management(featLyr, "ID", tblView, "NETWORK_ID") &amp;lt;Result 'Streets_Layer'&amp;gt; &amp;gt;&amp;gt;&amp;gt; rows = arcpy.SearchCursor(featLyr) &amp;gt;&amp;gt;&amp;gt; row = rows.next() &amp;gt;&amp;gt;&amp;gt; row.getValue("Streets.ID") 78400003854190.0 &amp;gt;&amp;gt;&amp;gt; row.getValue("Streets_DailyProfiles.NETWORK_ID") 78400003854190.0&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I assume you used a closing quote in your second example, and just missed it on the forum post?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 21:18:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/printing-field-name-using-search-cursor-on-a/m-p/178309#M13698</guid>
      <dc:creator>LoganPugh</dc:creator>
      <dc:date>2012-02-06T21:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: Printing Field name Using Search Cursor on a Joined Field</title>
      <link>https://community.esri.com/t5/python-questions/printing-field-name-using-search-cursor-on-a/m-p/178310#M13699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey Logan,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for posting that. I see where my error is now. I was trying to loop though the variable used for the original table instead of reading from the feature layer I created. I only noticed that when I compared what I had to yours. This works now. Thanks for the help!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 22:00:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/printing-field-name-using-search-cursor-on-a/m-p/178310#M13699</guid>
      <dc:creator>MikeMacRae</dc:creator>
      <dc:date>2012-02-06T22:00:13Z</dc:date>
    </item>
  </channel>
</rss>

