<?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: How do you add dashes using field calculator? Example 6411 10 6411 12 to 6411-10 6411-12 in 911 GIS Questions</title>
    <link>https://community.esri.com/t5/911-gis-questions/how-do-you-add-dashes-using-field-calculator/m-p/872683#M648</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oooh, shiny.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 08 Jul 2016 23:47:12 GMT</pubDate>
    <dc:creator>BlakeTerhune</dc:creator>
    <dc:date>2016-07-08T23:47:12Z</dc:date>
    <item>
      <title>How do you add dashes using field calculator? Example 6411 10 6411 12 to 6411-10 6411-12</title>
      <link>https://community.esri.com/t5/911-gis-questions/how-do-you-add-dashes-using-field-calculator/m-p/872678#M643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a feature in a geodatabase with over a thousand records and need to add dashes to the numbers in a field.&lt;/P&gt;&lt;P&gt;Example: 6411 10 6411 12 to 6411-10 6411-12&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jul 2016 21:10:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/911-gis-questions/how-do-you-add-dashes-using-field-calculator/m-p/872678#M643</guid>
      <dc:creator>MikeLetterman</dc:creator>
      <dc:date>2016-07-08T21:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do you add dashes using field calculator? Example 6411 10 6411 12 to 6411-10 6411-12</title>
      <link>https://community.esri.com/t5/911-gis-questions/how-do-you-add-dashes-using-field-calculator/m-p/872679#M644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For starters, you would need a field that is a string type (text) not numerical.&amp;nbsp; You can then populate it by concatenating a dash into it at the appropriate places.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, a simplistic way would be to shred 6411 10 6411 12 down to it's 4 pieces and place each piece in it's own field, say field &lt;EM&gt;A&lt;/EM&gt;, &lt;EM&gt;B&lt;/EM&gt;, &lt;EM&gt;C&lt;/EM&gt;, &lt;EM&gt;D&lt;/EM&gt;.&amp;nbsp; For example, &lt;EM&gt;A&lt;/EM&gt; would contain 6411, &lt;EM&gt;B&lt;/EM&gt; 10, etc.&amp;nbsp; Then create a text field for your final result, we'll call it field &lt;EM&gt;E&lt;/EM&gt;.&amp;nbsp; Then run &lt;EM&gt;Field Calculator &lt;/EM&gt;​on field &lt;EM&gt;E&lt;/EM&gt;, with the &lt;EM&gt;VB script&lt;/EM&gt; expression:&amp;nbsp; &lt;A&gt; &amp;amp; "-" &amp;amp; &lt;B&gt; &amp;amp; " " &amp;amp; &lt;C&gt; &amp;amp; "-" &amp;amp; &lt;D&gt;.&lt;/D&gt;&lt;/C&gt;&lt;/B&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are probably even easier/more elegant ways to do this with &lt;EM&gt;Python&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One catch will be whether all your data is laid out in the same sequence; if it varies it may take some data cleanup or additional code to get it sorted out before concatenating.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chris Donohue, GISP&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jul 2016 22:14:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/911-gis-questions/how-do-you-add-dashes-using-field-calculator/m-p/872679#M644</guid>
      <dc:creator>ChrisDonohue__GISP</dc:creator>
      <dc:date>2016-07-08T22:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do you add dashes using field calculator? Example 6411 10 6411 12 to 6411-10 6411-12</title>
      <link>https://community.esri.com/t5/911-gis-questions/how-do-you-add-dashes-using-field-calculator/m-p/872680#M645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In python it is a bit easier since there is a way to do away with all that stupid converting types from int/float to string and the like. onsider&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; a = 1
&amp;gt;&amp;gt;&amp;gt; b= 'b'
&amp;gt;&amp;gt;&amp;gt; c=1.2
&amp;gt;&amp;gt;&amp;gt; d ='x'
&amp;gt;&amp;gt;&amp;gt; "{}-{}-{}-{}".format(a,b,c,d)
'1-b-1.2-x'&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now your destination field still needs to be a string, but all you need to do is set your parser to python and use your field names enclosed in exclamation marks&amp;nbsp; like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14pt;"&gt;"{}-{}-{}-{}".format( !a!, !b!, !c!, !d! )&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:54:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/911-gis-questions/how-do-you-add-dashes-using-field-calculator/m-p/872680#M645</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-12T10:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do you add dashes using field calculator? Example 6411 10 6411 12 to 6411-10 6411-12</title>
      <link>https://community.esri.com/t5/911-gis-questions/how-do-you-add-dashes-using-field-calculator/m-p/872681#M646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I like the &lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;A href="https://docs.python.org/2/library/stdtypes.html#str.format"&gt;string.format()&lt;/A&gt;​&lt;/SPAN&gt; method because the values your concatenating with the dashes don't have to be strings, it will do the casting automatically. But like Dan mentioned, just make sure the output field is a string with a long enough length to accommodate the new value.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jul 2016 23:24:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/911-gis-questions/how-do-you-add-dashes-using-field-calculator/m-p/872681#M646</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2016-07-08T23:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do you add dashes using field calculator? Example 6411 10 6411 12 to 6411-10 6411-12</title>
      <link>https://community.esri.com/t5/911-gis-questions/how-do-you-add-dashes-using-field-calculator/m-p/872682#M647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;in python 3.6, this is now even more simplified...&lt;/P&gt;&lt;P&gt;if you like raw format r"f:\test\path"&lt;/P&gt;&lt;P&gt;you will love the new format&amp;nbsp; &lt;A href="https://docs.python.org/3.6/whatsnew/3.6.html#whatsnew-fstrings" title="https://docs.python.org/3.6/whatsnew/3.6.html#whatsnew-fstrings"&gt;What’s New In Python 3.6 — Python 3.6.0a2 documentation&lt;/A&gt; &lt;/P&gt;&lt;P&gt;f formatting&lt;/P&gt;&lt;P&gt;&lt;SPAN class="gp" style="color: #c65d09; font-weight: bold;"&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/SPAN&gt;&lt;SPAN class="n"&gt;name&lt;/SPAN&gt; &lt;SPAN class="o" style="color: #666666;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="s2" style="color: #4070a0;"&gt;"Fred"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="gp" style="color: #c65d09; font-weight: bold;"&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/SPAN&gt;&lt;SPAN class="n"&gt;f&lt;/SPAN&gt;&lt;SPAN class="s2" style="color: #4070a0;"&gt;"He said his name is &lt;/SPAN&gt;&lt;SPAN class="si" style="color: #70a0d0; font-style: italic;"&gt;{name}&lt;/SPAN&gt;&lt;SPAN class="s2" style="color: #4070a0;"&gt;."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="go"&gt;'He said his name is Fred.'&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jul 2016 23:28:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/911-gis-questions/how-do-you-add-dashes-using-field-calculator/m-p/872682#M647</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-07-08T23:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do you add dashes using field calculator? Example 6411 10 6411 12 to 6411-10 6411-12</title>
      <link>https://community.esri.com/t5/911-gis-questions/how-do-you-add-dashes-using-field-calculator/m-p/872683#M648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oooh, shiny.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jul 2016 23:47:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/911-gis-questions/how-do-you-add-dashes-using-field-calculator/m-p/872683#M648</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2016-07-08T23:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do you add dashes using field calculator? Example 6411 10 6411 12 to 6411-10 6411-12</title>
      <link>https://community.esri.com/t5/911-gis-questions/how-do-you-add-dashes-using-field-calculator/m-p/872684#M649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree, formatted string literals are nice syntactic sugar.&amp;nbsp; Unfortunately, we still have some time until final release and then a bit longer until incorporated into ArcGIS products.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Jul 2016 14:32:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/911-gis-questions/how-do-you-add-dashes-using-field-calculator/m-p/872684#M649</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2016-07-09T14:32:39Z</dc:date>
    </item>
  </channel>
</rss>

