<?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 Looking for arcade expression to Insert character at specific point in text string in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/looking-for-arcade-expression-to-insert-character/m-p/1264725#M748</link>
    <description>&lt;P&gt;I'm typing in a Number like the following,&amp;nbsp;1701010000001000 into a PARCELID text field.&lt;/P&gt;&lt;P&gt;This number gets populated into another field (NAME) through a simple calculation attribute rule.&lt;/P&gt;&lt;P&gt;However, what I'd like to see in the NAME field is this,&amp;nbsp;17-01-01-0-000-001.000&lt;/P&gt;&lt;P&gt;Can anyone share some arcade expression to get me started, my experience with arcade in very limited.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Robert&lt;/P&gt;&lt;P&gt;ArcGIS Pro ver. 3.0.3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Mar 2023 22:13:59 GMT</pubDate>
    <dc:creator>RobertChaney</dc:creator>
    <dc:date>2023-03-06T22:13:59Z</dc:date>
    <item>
      <title>Looking for arcade expression to Insert character at specific point in text string</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/looking-for-arcade-expression-to-insert-character/m-p/1264725#M748</link>
      <description>&lt;P&gt;I'm typing in a Number like the following,&amp;nbsp;1701010000001000 into a PARCELID text field.&lt;/P&gt;&lt;P&gt;This number gets populated into another field (NAME) through a simple calculation attribute rule.&lt;/P&gt;&lt;P&gt;However, what I'd like to see in the NAME field is this,&amp;nbsp;17-01-01-0-000-001.000&lt;/P&gt;&lt;P&gt;Can anyone share some arcade expression to get me started, my experience with arcade in very limited.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Robert&lt;/P&gt;&lt;P&gt;ArcGIS Pro ver. 3.0.3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 22:13:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/looking-for-arcade-expression-to-insert-character/m-p/1264725#M748</guid>
      <dc:creator>RobertChaney</dc:creator>
      <dc:date>2023-03-06T22:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for arcade expression to Insert character at specific point in text string</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/looking-for-arcade-expression-to-insert-character/m-p/1264751#M749</link>
      <description>&lt;P&gt;It's no work of art but it may give you an idea of what may be needed.&amp;nbsp; Assumption that the string length and format never changes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;//cast your number to a string
var string = Text($feature.PARCELID)
//make a list of each character in the string
var splitString = Split(string,"")
//shorten variable name for ease of reading
var sS = splitString
//logic to construct output string, incomplete
sS[0] + sS[1] + "-"
+ sS[2] + +sS[3] + "-" &lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 06 Mar 2023 23:41:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/looking-for-arcade-expression-to-insert-character/m-p/1264751#M749</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2023-03-06T23:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for arcade expression to Insert character at specific point in text string</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/looking-for-arcade-expression-to-insert-character/m-p/1264757#M750</link>
      <description>&lt;P&gt;Another way would be like this, using &lt;A href="https://developers.arcgis.com/arcade/guide/template-literals/" target="_self"&gt;Template literals&lt;/A&gt; and Text functions&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var test = 1701010000001000; //this also work if it's a string (ie "1701010000001000")

return `${Left(test,2)}-${Mid(test,2,2)}-${Mid(test,4,2)}-${Mid(test,6,1)}-${Mid(test,7,3)}-${Mid(test,10,3)}.${Mid(test,13,3)}`&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 00:15:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/looking-for-arcade-expression-to-insert-character/m-p/1264757#M750</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2023-03-07T00:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for arcade expression to Insert character at specific point in text string</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/looking-for-arcade-expression-to-insert-character/m-p/1264890#M751</link>
      <description>&lt;P&gt;A configurable way:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var parcel_id = Split(Text($feature.PARCELID), "")
//var parcel_id = Split("1701010000001000", "")

var counts = [2, 2, 2, 1, 3, 3, 3]
var separators = ["-", "-", "-", "-", "-", ".", null]

var formatted_id = ""
var index = 0
for(var c in counts) {
    var part = Concatenate(Slice(parcel_id, index, index + counts[c]))
    formatted_id += part + separators[c]
    index += counts[c]
}
return formatted_id&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 07 Mar 2023 12:47:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/looking-for-arcade-expression-to-insert-character/m-p/1264890#M751</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-03-07T12:47:26Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for arcade expression to Insert character at specific point in text string</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/looking-for-arcade-expression-to-insert-character/m-p/1265017#M752</link>
      <description>&lt;P&gt;David,&lt;/P&gt;&lt;P&gt;&amp;nbsp;Thanks for your reply.&amp;nbsp; The expression works fine for labels, however, when adding it to the calculation attribute rule I get a ERROR 002717: Invalid Arcade expression, Arcade error, Index out of bounds, Script line: 8&lt;/P&gt;&lt;LI-CODE lang="c"&gt;//cast your number to a string
var string = Text($feature.PARCELID)
//make a list of each character in the string
var splitString = Split(string,"")
//shorten variable name for ease of reading
var sS = splitString
//logic to construct output string, incomplete
sS[0] + sS[1] + "-" + sS[2] + sS[3] + "-" + sS[4] + sS[5] + "-" + sS[6] + "-" + sS[7] + sS[8] + sS[9] + "-" + sS[10] + sS[11] + sS[12] + "." + sS[13] + sS[14] + sS[15]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 17:12:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/looking-for-arcade-expression-to-insert-character/m-p/1265017#M752</guid>
      <dc:creator>RobertChaney</dc:creator>
      <dc:date>2023-03-07T17:12:41Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for arcade expression to Insert character at specific point in text string</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/looking-for-arcade-expression-to-insert-character/m-p/1265023#M753</link>
      <description>&lt;P&gt;Ken,&lt;/P&gt;&lt;P&gt;&amp;nbsp;Your expression works, if I replace the actual number&amp;nbsp;with $feature.PARCELID, it does what I need.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var test = $feature.PARCELID; //this also work if it's a string (ie "1701010000001000")

return `${Left(test,2)}-${Mid(test,2,2)}-${Mid(test,4,2)}-${Mid(test,6,1)}-${Mid(test,7,3)}-${Mid(test,10,3)}.${Mid(test,13,3)}`&lt;/LI-CODE&gt;&lt;P&gt;Thank you for your input.&lt;/P&gt;&lt;P&gt;Robert.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 17:19:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/looking-for-arcade-expression-to-insert-character/m-p/1265023#M753</guid>
      <dc:creator>RobertChaney</dc:creator>
      <dc:date>2023-03-07T17:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for arcade expression to Insert character at specific point in text string</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/looking-for-arcade-expression-to-insert-character/m-p/1265024#M754</link>
      <description>&lt;P&gt;Johannes,&lt;/P&gt;&lt;P&gt;&amp;nbsp;Your expression works as well, thank you for your input.&lt;/P&gt;&lt;P&gt;Robert.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 17:21:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/looking-for-arcade-expression-to-insert-character/m-p/1265024#M754</guid>
      <dc:creator>RobertChaney</dc:creator>
      <dc:date>2023-03-07T17:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for arcade expression to Insert character at specific point in text string</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/looking-for-arcade-expression-to-insert-character/m-p/1265028#M755</link>
      <description>&lt;P&gt;We gave you solutions for parcel ids with exactly 16 characters. Is this always the case?&lt;/P&gt;&lt;P&gt;You also should implement a null check:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if(IsEmpty($feature.PARCELID)) { return null }
// any of our expressions after this.&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 07 Mar 2023 17:23:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/looking-for-arcade-expression-to-insert-character/m-p/1265028#M755</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-03-07T17:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for arcade expression to Insert character at specific point in text string</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/looking-for-arcade-expression-to-insert-character/m-p/1265176#M756</link>
      <description>&lt;P&gt;Yes, this field should always contain 16 characters.&amp;nbsp; I'll implement the null check.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 21:16:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/looking-for-arcade-expression-to-insert-character/m-p/1265176#M756</guid>
      <dc:creator>RobertChaney</dc:creator>
      <dc:date>2023-03-07T21:16:00Z</dc:date>
    </item>
  </channel>
</rss>

