<?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: Code Help in Geodatabase Questions</title>
    <link>https://community.esri.com/t5/geodatabase-questions/code-help/m-p/824462#M3955</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, this does work, Thanks.&amp;nbsp; I even modified it a bit for other species and it works. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;def getSB(spcomb):&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if 'Sb' in spcomb:&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n = spcomb.find('Sb')&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return spcomb[n+3:n+6]&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't understand what "return spcomb[n+3:n+6]"&amp;nbsp; is but I changed the n+4 to n+3 and the 'Sb&amp;nbsp; ' to 'Sb' and it worked for the Sb 100 so I'm assuming it relates to 6 spaces to the right of Sb and 3 back from that.&lt;/P&gt;&lt;P&gt;Thanks to everyone for helping me with this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Aug 2015 22:59:14 GMT</pubDate>
    <dc:creator>JonPeroff</dc:creator>
    <dc:date>2015-08-24T22:59:14Z</dc:date>
    <item>
      <title>Code Help</title>
      <link>https://community.esri.com/t5/geodatabase-questions/code-help/m-p/824454#M3947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm in need of some help.&amp;nbsp; I have a file with a attribute field named SPCOMP and I need to separate it out.&amp;nbsp; The SPCOMP field is populated with a string such as "Sb&amp;nbsp; 90Bf&amp;nbsp; 10" or Pj&amp;nbsp; 80Sb&amp;nbsp; 20" or Pj&amp;nbsp; 40Bw&amp;nbsp; 40Sb&amp;nbsp; 20"&amp;nbsp; etc.&amp;nbsp; I'm trying to write a code using the field calculator in VB &lt;/P&gt;&lt;P&gt;script that will search through the SPCOMP field for "Sb&amp;nbsp; 90" and populate another field SB with 90 or search for "Sb&amp;nbsp; 60" and put 60 &lt;/P&gt;&lt;P&gt;in the SB field.&amp;nbsp; My code is:&lt;/P&gt;&lt;P&gt;Dim SB&lt;/P&gt;&lt;P&gt;if [SPCOMP] = "%Sb&amp;nbsp; 90%" Then&lt;/P&gt;&lt;P&gt;SB = 90&lt;/P&gt;&lt;P&gt;elseif [SPCOMP] = "%Sb&amp;nbsp; 60%" Then&lt;/P&gt;&lt;P&gt;SB = 60&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;SB = 1&lt;/P&gt;&lt;P&gt;end if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I run this it will populate the SB field with 1 so I think my mistake is with the wildcard search?&amp;nbsp; Can anyone offer suggestions on this or where I could find answers?&amp;nbsp; I'm using ArcGIS advanced 10.3.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Aug 2015 21:32:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/code-help/m-p/824454#M3947</guid>
      <dc:creator>JonPeroff</dc:creator>
      <dc:date>2015-08-21T21:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: Code Help</title>
      <link>https://community.esri.com/t5/geodatabase-questions/code-help/m-p/824455#M3948</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Like&lt;/STRONG&gt; operator perhaps?&amp;nbsp; from the 10.3 help files...but nothing has changed you can try "building a query expression" or "wildcard" as search terms in your help&lt;/P&gt;&lt;P&gt;&lt;A href="http://desktop.arcgis.com/en/desktop/latest/map/working-with-layers/building-a-query-expression.htm" title="http://desktop.arcgis.com/en/desktop/latest/map/working-with-layers/building-a-query-expression.htm"&gt;Building a query expression—Help | ArcGIS for Desktop&lt;/A&gt;&lt;/P&gt;&lt;P style="font-size: 0.875rem; margin-bottom: 1.71429em; color: #4d4d4d; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Use the LIKE operator (instead of the = operator) to build a partial string search. For example, this expression would select Mississippi and Missouri among U.S. state names:&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;STATE_NAME LIKE 'Miss%'&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;% means that anything is acceptable in its place: one character, a hundred characters, or no character. Alternatively, if you want to search with a wildcard that represents one character, use _.&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;For example, this expression would find Catherine Smith and Katherine Smith:&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;OWNER_NAME LIKE '_atherine smith'&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;The wildcards above work for any file-based data or ArcSDE geodatabase. The wildcards you use to query personal geodatabases are * for any number of characters and ? for one character.&lt;/P&gt;&lt;P&gt;​&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Aug 2015 00:00:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/code-help/m-p/824455#M3948</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-08-22T00:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: Code Help</title>
      <link>https://community.esri.com/t5/geodatabase-questions/code-help/m-p/824456#M3949</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are interested in using the Python syntax you could use this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;def getSB(spcomb):
&amp;nbsp;&amp;nbsp;&amp;nbsp; if 'Sb&amp;nbsp; ' in spcomb:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n = spcomb.find('Sb&amp;nbsp; ')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return spcomb[n+4:n+6]
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;getSB( !SPCOMP! )&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/123421_pastedImage_4.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;and the result:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/123425_pastedImage_6.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;Before you try this, you ask this question: &lt;EM&gt;Is it always a number between 10 and 99 (two digits)?&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;... it will fail if:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;the number is &amp;lt;10 and &amp;gt; 99&lt;/LI&gt;&lt;LI&gt;if it isn't a number (should check to see if it is numeric)&lt;/LI&gt;&lt;LI&gt;Code wil not find 'SB' or 'sB' or 'sb', it is case sensitive&lt;/LI&gt;&lt;LI&gt;etc...&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:49:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/code-help/m-p/824456#M3949</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-12T09:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Code Help</title>
      <link>https://community.esri.com/t5/geodatabase-questions/code-help/m-p/824457#M3950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have tried the LIKE operator in VB but the error message is always 99999 (general error) I tried may different ways but the same result.&amp;nbsp; If I type the SPCOMP code in exactly&amp;nbsp; then it works.&lt;/P&gt;&lt;P&gt;(ie: if [SPCOMP] = 'Sb&amp;nbsp; 90Bf&amp;nbsp; 10')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried the python but it does not work either.&amp;nbsp; I never used python before and don't understand it either.&amp;nbsp; Maybe I should though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And yes the string is exact (it's either SB or Sb but never both in the same file.)&lt;/P&gt;&lt;P&gt;in the VB calculator, this is my code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dim SB&lt;/P&gt;&lt;P&gt;if [SPCOMP] LIKE '%Sb 100%' Then&lt;BR /&gt;SB = 100&lt;/P&gt;&lt;P&gt;elseif [SPCOMP] LIKE '%Sb&amp;nbsp; 90%' Then&lt;BR /&gt;SB = 90&lt;/P&gt;&lt;P&gt;elseif [SPCOMP] LIKE '%Sb&amp;nbsp; 80%' Then&lt;BR /&gt;SB = 80&lt;/P&gt;&lt;P&gt;elseif [SPCOMP] LIKE '%Sb&amp;nbsp; 70%' Then&lt;BR /&gt;SB = 70&lt;/P&gt;&lt;P&gt;elseif [SPCOMP] LIKE '%Sb&amp;nbsp; 60%' Then&lt;BR /&gt;SB = 60&lt;/P&gt;&lt;P&gt;elseif [SPCOMP] LIKE '%Sb&amp;nbsp; 50%' Then&lt;BR /&gt;SB = 50&lt;/P&gt;&lt;P&gt;elseif [SPCOMP] LIKE '%Sb&amp;nbsp; 40%' Then&lt;BR /&gt;SB = 40&lt;/P&gt;&lt;P&gt;elseif [SPCOMP] LIKE '%Sb&amp;nbsp; 30%' Then&lt;BR /&gt;SB = 30&lt;/P&gt;&lt;P&gt;elseif [SPCOMP] LIKE '%Sb&amp;nbsp; 20%' Then&lt;BR /&gt;SB = 20&lt;/P&gt;&lt;P&gt;elseif [SPCOMP] LIKE '%Sb&amp;nbsp; 10%' Then&lt;BR /&gt;SB = 10&lt;/P&gt;&lt;P&gt;else&lt;BR /&gt;SB = 0&lt;BR /&gt;end if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in the lower box (SB=)&lt;/P&gt;&lt;P&gt;SB&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I posted my .gdb here as a zip file. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/file/d/0B3tBBFkFiMrIMktNaThKQ1ZkdEk/view?usp=sharing"&gt;https://drive.google.com/file/d/0B3tBBFkFiMrIMktNaThKQ1ZkdEk/view?usp=sharing&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2015 16:06:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/code-help/m-p/824457#M3950</guid>
      <dc:creator>JonPeroff</dc:creator>
      <dc:date>2015-08-24T16:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: Code Help</title>
      <link>https://community.esri.com/t5/geodatabase-questions/code-help/m-p/824458#M3951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use select by attributes to get a selection then use field calculator to populate the intended field&lt;/P&gt;&lt;P&gt;fieldname&amp;nbsp; LIKE '%90%'&lt;/P&gt;&lt;P&gt;Then field calculate the selection set to 90&lt;/P&gt;&lt;P&gt;repeat for 60&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2015 17:30:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/code-help/m-p/824458#M3951</guid>
      <dc:creator>WesMiller</dc:creator>
      <dc:date>2015-08-24T17:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: Code Help</title>
      <link>https://community.esri.com/t5/geodatabase-questions/code-help/m-p/824459#M3952</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you attach the ZIP to the thread (click on advanced editor upper right corner and then on Attach in lower right corner), since I wasn't able to download your file:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/123733_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2015 17:37:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/code-help/m-p/824459#M3952</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-08-24T17:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: Code Help</title>
      <link>https://community.esri.com/t5/geodatabase-questions/code-help/m-p/824460#M3953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks I didn't know how to attach a file. &lt;/P&gt;&lt;P&gt;Wes suggested select by attributes then using the calculator and I know that works but there are 14 species and 10 percentages each so that tends to become tedious after a while.&amp;nbsp; The combination I'm looking for is Sb&amp;nbsp; 90 or SB&amp;nbsp; 80 or PO&amp;nbsp; 20 or LA&amp;nbsp; 70&amp;nbsp; etc&amp;nbsp;&amp;nbsp; Hopefully, the attached file will help.&amp;nbsp; I can do this in MS excel but I would like to do it in ARCmap&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2015 19:23:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/code-help/m-p/824460#M3953</guid>
      <dc:creator>JonPeroff</dc:creator>
      <dc:date>2015-08-24T19:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: Code Help</title>
      <link>https://community.esri.com/t5/geodatabase-questions/code-help/m-p/824461#M3954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The code I posted earlier seems to work on your data:&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="123734" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/123734_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;... however, looking at your data and the fact that you want to apply this to multiple fields, I think using Python code and an update cursor would be easier...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Edit: I see that the result is wrong for "Sb 100"&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2015 22:14:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/code-help/m-p/824461#M3954</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-08-24T22:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: Code Help</title>
      <link>https://community.esri.com/t5/geodatabase-questions/code-help/m-p/824462#M3955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, this does work, Thanks.&amp;nbsp; I even modified it a bit for other species and it works. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;def getSB(spcomb):&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if 'Sb' in spcomb:&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n = spcomb.find('Sb')&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return spcomb[n+3:n+6]&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't understand what "return spcomb[n+3:n+6]"&amp;nbsp; is but I changed the n+4 to n+3 and the 'Sb&amp;nbsp; ' to 'Sb' and it worked for the Sb 100 so I'm assuming it relates to 6 spaces to the right of Sb and 3 back from that.&lt;/P&gt;&lt;P&gt;Thanks to everyone for helping me with this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2015 22:59:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/code-help/m-p/824462#M3955</guid>
      <dc:creator>JonPeroff</dc:creator>
      <dc:date>2015-08-24T22:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Code Help</title>
      <link>https://community.esri.com/t5/geodatabase-questions/code-help/m-p/824463#M3956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As mentioned before, I would probably use some Python code to do the job:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/123809_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;This table was updated using this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;def main():
&amp;nbsp;&amp;nbsp;&amp;nbsp; import arcpy
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc = r"C:\GeoNet\SPCOMP\ARC.gdb\SPCOMP"
&amp;nbsp;&amp;nbsp;&amp;nbsp; fld_in = "SPCOMP"

&amp;nbsp;&amp;nbsp;&amp;nbsp; # create list of fields with length 2
&amp;nbsp;&amp;nbsp;&amp;nbsp; flds = [fld.name for fld in arcpy.ListFields(fc) if len(fld.name) == 2]
&amp;nbsp;&amp;nbsp;&amp;nbsp; flds.insert(0, fld_in)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # start update cursor
&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor(fc, flds) as curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; spcomp = row[0].upper()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for fldname in flds[1:]:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if fldname.upper() in spcomp:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; perc = getPercentage(fldname.upper(), spcomp)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[flds.index(fldname)] = perc
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curs.updateRow(row)

def getPercentage(fldname, spcomp):
&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n = spcomp.find(fldname)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; part = spcomp[n+2:n+6]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return int(part)
&amp;nbsp;&amp;nbsp;&amp;nbsp; except:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return -1

if __name__ == '__main__':
&amp;nbsp;&amp;nbsp;&amp;nbsp; main()&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some assumptions that seem to be true for this table:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;field names that need to be updated are two characters long and correspond to the specie&lt;/LI&gt;&lt;LI&gt;a species inside the field SPCOMP always occupies 5 characters.&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:49:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/code-help/m-p/824463#M3956</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-12T09:49:11Z</dc:date>
    </item>
  </channel>
</rss>

