<?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: Inline Variable Truncate in ModelBuilder Questions</title>
    <link>https://community.esri.com/t5/modelbuilder-questions/inline-variable-truncate/m-p/827592#M1708</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Duncan's great example was done using a code block so he could comment it so awesomely, but it should be noted you can&amp;nbsp; put the Python expression right in the main expression block (no code block function required) as:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="string token"&gt;"%Name%"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;5&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;or&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="string token"&gt;"%Name%"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replace&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Site_"&lt;/SPAN&gt;&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;‍‍
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Also, if "Site" is an integer field you would&amp;nbsp;need to "int" the result (unlike the VB parser, you need to make sure the datatype matches):&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;int&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"%Name%"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;5&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 09:58:18 GMT</pubDate>
    <dc:creator>curtvprice</dc:creator>
    <dc:date>2021-12-12T09:58:18Z</dc:date>
    <item>
      <title>Inline Variable Truncate</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/inline-variable-truncate/m-p/827590#M1706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I have a model that Iterates through a GDB and then strip out unwanted fields and then adds a field and populates it with the name of the origin feature class. This works as expected. However, what I would like to do is run the "Calculate Field" tool and still use the inline variable but remove the first part of it. (i.e. Site_26105 to 26105).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I accomplish this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Respectfully,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eric&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2018 14:58:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/inline-variable-truncate/m-p/827590#M1706</guid>
      <dc:creator>EricStarn3</dc:creator>
      <dc:date>2018-07-31T14:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Inline Variable Truncate</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/inline-variable-truncate/m-p/827591#M1707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You achieve this by python string slicing.&amp;nbsp; So assuming all your input featureclass names are always the format of "Site_1234" then your field calculate tool need only be this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="418857" alt="Calculate Field and string slicing" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/418857_Untitled.png" /&gt;&lt;/P&gt;&lt;P&gt;To complete the expression click on the calculator button and complete as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="418868" alt="Building the expression" class="image-2 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/418868_Untitled.png" /&gt;&lt;/P&gt;&lt;P&gt;Note the &lt;EM&gt;parser type&lt;/EM&gt;, &lt;EM&gt;code block&lt;/EM&gt; the&lt;EM&gt; indentation&lt;/EM&gt; in the script logic and your in-line variable is between &lt;EM&gt;double quotes&lt;/EM&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Aug 2018 10:47:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/inline-variable-truncate/m-p/827591#M1707</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2018-08-16T10:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: Inline Variable Truncate</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/inline-variable-truncate/m-p/827592#M1708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Duncan's great example was done using a code block so he could comment it so awesomely, but it should be noted you can&amp;nbsp; put the Python expression right in the main expression block (no code block function required) as:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="string token"&gt;"%Name%"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;5&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;or&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="string token"&gt;"%Name%"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replace&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Site_"&lt;/SPAN&gt;&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;‍‍
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Also, if "Site" is an integer field you would&amp;nbsp;need to "int" the result (unlike the VB parser, you need to make sure the datatype matches):&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;int&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"%Name%"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;5&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:58:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/inline-variable-truncate/m-p/827592#M1708</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-12T09:58:18Z</dc:date>
    </item>
  </channel>
</rss>

