<?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 Merge Buffers After Creating/Calculating Field in ModelBuilder Questions</title>
    <link>https://community.esri.com/t5/modelbuilder-questions/merge-buffers-after-creating-calculating-field/m-p/858860#M1388</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am ultimately trying to merge my buffered layers together after I've created and calculated a field within each buffer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My steps within my submodel are&lt;/P&gt;&lt;P&gt;1: Iterate Row Selection from the Bus Route table list, which produces a Value&lt;/P&gt;&lt;P&gt;2: Select by Attribute from the Bus Stop layer the Value that's currently being iterated&lt;/P&gt;&lt;P&gt;3: Buffer the Bus Stop selection, and dissolve into single feature&lt;/P&gt;&lt;P&gt;4: Add Field to the newly created Stop Buffer layer&lt;/P&gt;&lt;P&gt;5: Calculate as text the newly created field&amp;nbsp;(expression is '%Value%')&lt;/P&gt;&lt;P&gt;6: Collect Values&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/438601_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My steps within my Main Model are&lt;/P&gt;&lt;P&gt;1: Run the submodel&lt;/P&gt;&lt;P&gt;2: Merge the collected values&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/438632_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Each time I run it, the field that was created in the buffer is not there. How do I include this newly created field in my Merge?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 04 Mar 2019 16:03:28 GMT</pubDate>
    <dc:creator>JaredKauffman1</dc:creator>
    <dc:date>2019-03-04T16:03:28Z</dc:date>
    <item>
      <title>Merge Buffers After Creating/Calculating Field</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/merge-buffers-after-creating-calculating-field/m-p/858860#M1388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am ultimately trying to merge my buffered layers together after I've created and calculated a field within each buffer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My steps within my submodel are&lt;/P&gt;&lt;P&gt;1: Iterate Row Selection from the Bus Route table list, which produces a Value&lt;/P&gt;&lt;P&gt;2: Select by Attribute from the Bus Stop layer the Value that's currently being iterated&lt;/P&gt;&lt;P&gt;3: Buffer the Bus Stop selection, and dissolve into single feature&lt;/P&gt;&lt;P&gt;4: Add Field to the newly created Stop Buffer layer&lt;/P&gt;&lt;P&gt;5: Calculate as text the newly created field&amp;nbsp;(expression is '%Value%')&lt;/P&gt;&lt;P&gt;6: Collect Values&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/438601_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My steps within my Main Model are&lt;/P&gt;&lt;P&gt;1: Run the submodel&lt;/P&gt;&lt;P&gt;2: Merge the collected values&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/438632_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Each time I run it, the field that was created in the buffer is not there. How do I include this newly created field in my Merge?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2019 16:03:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/merge-buffers-after-creating-calculating-field/m-p/858860#M1388</guid>
      <dc:creator>JaredKauffman1</dc:creator>
      <dc:date>2019-03-04T16:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Buffers After Creating/Calculating Field</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/merge-buffers-after-creating-calculating-field/m-p/858861#M1389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The issue here is that your field map for the merge is calculated at validate time, before any buffers or add fields happen in the submodel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can think of two things to try:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Add&amp;nbsp; field to Dec18Stops (STOPVAL, Long [I think]) in the main model before you run the submodel, and calculate that field in the submodel at each iteration. Dec18Stops should also be set up as a parameter to the submodel do the validation will pass correctly.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;Use a Calculate Value python function to create a field map in the main model, at runtime, passing it to the Merge. (This is a bit more complicated.)&lt;/LI&gt;&lt;/OL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Mar 2019 20:16:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/merge-buffers-after-creating-calculating-field/m-p/858861#M1389</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2019-03-05T20:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Buffers After Creating/Calculating Field</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/merge-buffers-after-creating-calculating-field/m-p/858862#M1390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Much like the initial poster, I had a model where a field kept disappearing.&amp;nbsp; Annoying and puzzling.&amp;nbsp; Your answer (&lt;SPAN style="background-color: #ffffff;"&gt;field map for the merge is calculated at validate time)&amp;nbsp;&lt;/SPAN&gt;put me on the right track to fix this - thanks! &lt;A href="https://community.esri.com/t5/tag/model/tg-p"&gt;#model&lt;/A&gt;‌ &lt;A href="https://community.esri.com/t5/tag/validate/tg-p"&gt;#validate&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Mar 2019 21:48:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/merge-buffers-after-creating-calculating-field/m-p/858862#M1390</guid>
      <dc:creator>JayJohnsonWashoeCounty</dc:creator>
      <dc:date>2019-03-05T21:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Buffers After Creating/Calculating Field</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/merge-buffers-after-creating-calculating-field/m-p/858863#M1391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the advice Curtis. Because I would like to make my process (which will include other submodels) as much of a one-button click as possible, I am more interested in the Calculate Value tool you mentioned. Unfortunately, I don't have any Python scripting experience. Is it possible to help explain what my script would look like? The field I'm adding to the buffer (in my submodel) is Text, because the express bus routes are denoted with an "X", which are also denoted the same way in the Dec2018 Excel file, as well as within the Dec2018Stops point feature class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Mar 2019 17:25:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/merge-buffers-after-creating-calculating-field/m-p/858863#M1391</guid>
      <dc:creator>JaredKauffman1</dc:creator>
      <dc:date>2019-03-06T17:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Buffers After Creating/Calculating Field</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/merge-buffers-after-creating-calculating-field/m-p/858864#M1392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm a little confused because I don't get why you are adding a field that is already there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The python code you need to do to create a field map at runtime would use the FieldMappings object.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-classes/fieldmappings.htm" title="https://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-classes/fieldmappings.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;FieldMappings—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's a script for the Calculate Value tool. NOT tested.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# expression&lt;/SPAN&gt;
fmap&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"%Output Values%"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# code block&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;fmap&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;cvalues&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
  cvals &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; cvalues&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;";"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
  fms &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;FieldMappings&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; ds &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; cvals&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    fms&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;addTable&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;ds&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; fms&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;exportToString&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# Data type Field Map, connect to Merge tool‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;A href="https://community.esri.com/message/772277" target="_blank"&gt;Field Mappings variable as a parameter not working in 10.5.1&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:37:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/merge-buffers-after-creating-calculating-field/m-p/858864#M1392</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-12T10:37:55Z</dc:date>
    </item>
  </channel>
</rss>

