<?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 Re: Trying to calculate values from two different tables using SearchCursor in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/trying-to-calculate-values-from-two-different/m-p/518637#M40619</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks a bunch Chris.&amp;nbsp; I'm pretty new at this and as usual I'm making it more complicated that it needs to be.&amp;nbsp; Python is a harsh mistress, yes?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Nov 2011 14:53:45 GMT</pubDate>
    <dc:creator>DavidHarlan</dc:creator>
    <dc:date>2011-11-09T14:53:45Z</dc:date>
    <item>
      <title>Trying to calculate values from two different tables using SearchCursor</title>
      <link>https://community.esri.com/t5/python-questions/trying-to-calculate-values-from-two-different/m-p/518635#M40617</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It seems like this should be easy but my script is choking on something.&amp;nbsp; I have two dbf tables that each have a field "SUM_LENGTH".&amp;nbsp; I want to divide the value of one field by the other.&amp;nbsp; Each table only has one row so I thought next() would be appropriate to access the row and GetValue would return the value.&amp;nbsp; I am doing something wrong though.&amp;nbsp; Any ideas?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;strcur = gp.SearchCursor(streamtable,"", "","SUM_LENGTH","")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Artcur = gp.SearchCursor(Arttable, "", "", "SUM_LENGTH", "")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;strrow = strcur.next()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;artrow = Artcur.next()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;strlen = strrow.GetValue("SUM_LENGTH")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;artlen = artrow.GetValue("SUM_LENGTH")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;index = artlen / strlen&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print index&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;del Artcur&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;del strcur&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2011 13:11:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trying-to-calculate-values-from-two-different/m-p/518635#M40617</guid>
      <dc:creator>DavidHarlan</dc:creator>
      <dc:date>2011-11-09T13:11:25Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to calculate values from two different tables using SearchCursor</title>
      <link>https://community.esri.com/t5/python-questions/trying-to-calculate-values-from-two-different/m-p/518636#M40618</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;getvalue() is for retreiving values when the field name is stored as a variable. In your case, you don't need it, since you already know the field name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Since there is only a single record in the tables, how about:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;strlen = gp.SearchCursor(streamtable,"", "","","").next().SUM_LENGTH&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;artlen = gp.SearchCursor(Arttable,"", "","","").next().SUM_LENGTH&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;index = artlen / float(strlen)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print index&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;del strlen, artlen&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2011 14:20:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trying-to-calculate-values-from-two-different/m-p/518636#M40618</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2011-11-09T14:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to calculate values from two different tables using SearchCursor</title>
      <link>https://community.esri.com/t5/python-questions/trying-to-calculate-values-from-two-different/m-p/518637#M40619</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks a bunch Chris.&amp;nbsp; I'm pretty new at this and as usual I'm making it more complicated that it needs to be.&amp;nbsp; Python is a harsh mistress, yes?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2011 14:53:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trying-to-calculate-values-from-two-different/m-p/518637#M40619</guid>
      <dc:creator>DavidHarlan</dc:creator>
      <dc:date>2011-11-09T14:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to calculate values from two different tables using SearchCursor</title>
      <link>https://community.esri.com/t5/python-questions/trying-to-calculate-values-from-two-different/m-p/518638#M40620</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Harsh at first perhaps.... Once you understand her though, she is a real gem &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2011 16:10:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trying-to-calculate-values-from-two-different/m-p/518638#M40620</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2011-11-09T16:10:45Z</dc:date>
    </item>
  </channel>
</rss>

