<?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 Model Builder Iterator to calculate value of field in ModelBuilder Questions</title>
    <link>https://community.esri.com/t5/modelbuilder-questions/model-builder-iterator-to-calculate-value-of-field/m-p/859941#M233</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I don't use ModelBuilder too much and am trying to help someone w/this issue.&amp;nbsp; I want to step through an attribute table and select each feature (currently trying the Iterate Feature Selection tool w/a group-by ID).&amp;nbsp; These IDs are a variety of things (some are short strings like 30-11-222, some are GUIDS {A122......} but the field is type String.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Simply, each time there is a new ID, copy that value and put it into another table that has an empty field called "ID".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is just a small extract of a larger model, so it's sort of abstracted.&amp;nbsp; But that's the basic idea of this section.&amp;nbsp; Can't seem to get it to go.&amp;nbsp; Originally, it would hang up on the Calculate Field b/c the 'value' coming from the iterator is type variant.&amp;nbsp; I tried throwing in a 'Calculate Value' tool to change that to a string type and then running the Calculate Field but it doesn't like that either (some sort of syntax error: unexpected EOF while parsing (&amp;lt;string&amp;gt;, line 1).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Attaching a screen shot for now.&amp;nbsp; Should be easier than this...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Feb 2011 17:40:59 GMT</pubDate>
    <dc:creator>mattstutts</dc:creator>
    <dc:date>2011-02-10T17:40:59Z</dc:date>
    <item>
      <title>Model Builder Iterator to calculate value of field</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/model-builder-iterator-to-calculate-value-of-field/m-p/859941#M233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I don't use ModelBuilder too much and am trying to help someone w/this issue.&amp;nbsp; I want to step through an attribute table and select each feature (currently trying the Iterate Feature Selection tool w/a group-by ID).&amp;nbsp; These IDs are a variety of things (some are short strings like 30-11-222, some are GUIDS {A122......} but the field is type String.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Simply, each time there is a new ID, copy that value and put it into another table that has an empty field called "ID".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is just a small extract of a larger model, so it's sort of abstracted.&amp;nbsp; But that's the basic idea of this section.&amp;nbsp; Can't seem to get it to go.&amp;nbsp; Originally, it would hang up on the Calculate Field b/c the 'value' coming from the iterator is type variant.&amp;nbsp; I tried throwing in a 'Calculate Value' tool to change that to a string type and then running the Calculate Field but it doesn't like that either (some sort of syntax error: unexpected EOF while parsing (&amp;lt;string&amp;gt;, line 1).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Attaching a screen shot for now.&amp;nbsp; Should be easier than this...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Feb 2011 17:40:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/model-builder-iterator-to-calculate-value-of-field/m-p/859941#M233</guid>
      <dc:creator>mattstutts</dc:creator>
      <dc:date>2011-02-10T17:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: Model Builder Iterator to calculate value of field</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/model-builder-iterator-to-calculate-value-of-field/m-p/859942#M234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm having this same issue Matt.&amp;nbsp; Did you ever come up with a solution?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Apr 2011 18:51:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/model-builder-iterator-to-calculate-value-of-field/m-p/859942#M234</guid>
      <dc:creator>ChristopherDeRolph</dc:creator>
      <dc:date>2011-04-11T18:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: Model Builder Iterator to calculate value of field</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/model-builder-iterator-to-calculate-value-of-field/m-p/859943#M235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Nope.&amp;nbsp; As usual, my questions go unanswered on this site.&amp;nbsp; I had completely forgotten about it.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Apr 2011 18:54:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/model-builder-iterator-to-calculate-value-of-field/m-p/859943#M235</guid>
      <dc:creator>mattstutts</dc:creator>
      <dc:date>2011-04-11T18:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Model Builder Iterator to calculate value of field</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/model-builder-iterator-to-calculate-value-of-field/m-p/859944#M236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Apparently this is a bug, but there is a workaround that works.&amp;nbsp; Here's the email I got from ESRI tech support:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Chris,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have found bug ID #NIM055433.&amp;nbsp; This bug recognizes that the Calculate Field tool fails when setting field value to iterator value when iterator uses a text field.&amp;nbsp; The workaround is to put quotations around the %value%, such as "%value%".&amp;nbsp; Please try this workaround and let me know the results.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your time and patience!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Evan B.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Apr 2011 15:29:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/model-builder-iterator-to-calculate-value-of-field/m-p/859944#M236</guid>
      <dc:creator>ChristopherDeRolph</dc:creator>
      <dc:date>2011-04-12T15:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: Model Builder Iterator to calculate value of field</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/model-builder-iterator-to-calculate-value-of-field/m-p/859945#M237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This code finds all unique IDs in a feature class, and sticks them into a new table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy

input = "H:/GIS_Data/TEMP_GDB.gdb/feattoline" # feature class to iterate
gdb = "H:/GIS_Data/TEMP_GDB.gdb" #gdb or folder for your new table
table = "JunkTable"
tabpath = gdb + "/" + table

arcpy.CreateTable_management(gdb,table)

arcpy.AddField_management(tabpath,"ID","TEXT")

rows = arcpy.SearchCursor(input)

ids = []

for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if row.FID_polyfc not in ids:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ids.append(row.FID_polyfc)

insrows = arcpy.InsertCursor(tabpath)

for id in ids:
&amp;nbsp;&amp;nbsp;&amp;nbsp; insrow = insrows.newRow()
&amp;nbsp;&amp;nbsp;&amp;nbsp; insrow.ID = id
&amp;nbsp;&amp;nbsp;&amp;nbsp; insrows.insertRow(insrow)

del row
del rows
del insrow
del insrows&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;PS - this is largely a community forum (ie. users answer questions on their own time), so don't be bitter if your question goes unanswered. Especially if it's not in the correct forum - this should be in 'Geoprocessing'.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:39:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/model-builder-iterator-to-calculate-value-of-field/m-p/859945#M237</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-12T10:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: Model Builder Iterator to calculate value of field</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/model-builder-iterator-to-calculate-value-of-field/m-p/859946#M238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the assistance.. It turns out that I don't need to have a draw order field that starts at 0 every time for Tableau, it just needs to be sequential. So if I add a new field that mimics the FID field, it should do the trick.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Aug 2014 20:11:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/model-builder-iterator-to-calculate-value-of-field/m-p/859946#M238</guid>
      <dc:creator>JamesDuBois</dc:creator>
      <dc:date>2014-08-27T20:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: Model Builder Iterator to calculate value of field</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/model-builder-iterator-to-calculate-value-of-field/m-p/1170174#M239</link>
      <description>&lt;P&gt;Thanks! This works and saved me a bunch of time!&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2022 15:22:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/model-builder-iterator-to-calculate-value-of-field/m-p/1170174#M239</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-05-03T15:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: Model Builder Iterator to calculate value of field</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/model-builder-iterator-to-calculate-value-of-field/m-p/1213625#M240</link>
      <description>&lt;P&gt;All,&lt;/P&gt;&lt;P&gt;I encountered this same problem in ModelBuilder in ArcGIS Pro 3.0 today ten years later and FYI the workaround still appears to do the job.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Joe&lt;/P&gt;</description>
      <pubDate>Sat, 17 Sep 2022 00:06:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/model-builder-iterator-to-calculate-value-of-field/m-p/1213625#M240</guid>
      <dc:creator>Joseph_Kinyon</dc:creator>
      <dc:date>2022-09-17T00:06:35Z</dc:date>
    </item>
  </channel>
</rss>

