<?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: Calculation Attribute Rule: How to account for inconsistent spaces separating values in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/calculation-attribute-rule-how-to-account-for/m-p/1574089#M1663</link>
    <description>&lt;P&gt;please do not break this into multiple attribute rules.&amp;nbsp; There is a cost to each rule&lt;/P&gt;</description>
    <pubDate>Thu, 09 Jan 2025 18:57:55 GMT</pubDate>
    <dc:creator>MikeMillerGIS</dc:creator>
    <dc:date>2025-01-09T18:57:55Z</dc:date>
    <item>
      <title>Calculation Attribute Rule: How to account for inconsistent spaces separating values</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/calculation-attribute-rule-how-to-account-for/m-p/1573772#M1659</link>
      <description>&lt;P&gt;I need help creating a arcade expression for a Attribute Calculation Rule that calculates the values from one field (Parcel Identification Number) whose values are separated by spaces, into three different fields (Map Book Page, Block/Landlot Number, and Parcel ID Number).&amp;nbsp; The only problem is that the values in the Parcel Identification Number field that I'm attempting to calculate to the other fields are separated by spaces which are &lt;EM&gt;&lt;STRONG&gt;inconsistent&lt;/STRONG&gt;&lt;/EM&gt; as far as how many spaces there may be between the values.&amp;nbsp; It's accounting for these inconsistencies in the amount of spaces that I'm not sure how to deal with.&amp;nbsp; Any help is greatly appreciated.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Robert.&lt;/P&gt;&lt;P&gt;ArcGIS Pro 3.3.1&lt;/P&gt;&lt;P&gt;Currently working with this data is test fgdb, but will move the data and attribute rule to an Enterprise GDB.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2025 23:12:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/calculation-attribute-rule-how-to-account-for/m-p/1573772#M1659</guid>
      <dc:creator>RobertChaney</dc:creator>
      <dc:date>2025-01-08T23:12:41Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Attribute Rule: How to account for inconsistent spaces separating values</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/calculation-attribute-rule-how-to-account-for/m-p/1573858#M1660</link>
      <description>&lt;P&gt;Is this what you are trying to do?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var val = "5 1     600"
var split_vals = Split(val, ' ')
var trimed_vals = []
for (var i in split_vals)
{
  if (IsEmpty(split_vals[i])){
    continue
  }
  Push(trimed_vals, split_vals[i])
}
return trimed_vals&lt;/LI-CODE&gt;&lt;P&gt;produces&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeMillerGIS_0-1736421748860.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/123010i3D4153070F48C659/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeMillerGIS_0-1736421748860.png" alt="MikeMillerGIS_0-1736421748860.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2025 11:22:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/calculation-attribute-rule-how-to-account-for/m-p/1573858#M1660</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2025-01-09T11:22:34Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Attribute Rule: How to account for inconsistent spaces separating values</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/calculation-attribute-rule-how-to-account-for/m-p/1574051#M1661</link>
      <description>&lt;P&gt;Thanks for your response Mike.&lt;/P&gt;&lt;P&gt;This is what I initially came up with based on what was generated from ChatGTP.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// Split the Parcel Identification Number (PARCELID) value by spaces
var parts = Split($feature["PARCELID"], " ")

//Calculate values based on the parts
var Map = IIf(Count(parts) &amp;gt; 0, Number(parts[0]), null)
var Land = IIf(Count(parts) &amp;gt; 1, Number(parts[1]), null)
var PID = IIf(Count(parts) &amp;gt; 2, Number(parts[2]), null)

//Return the results as a object
return {
    "Map": $feature.PAGEPARCELID,
    "Land": $feature.BLKLLPARCELID,
    "PID": $feature.LOWPARCELID
}&lt;/LI-CODE&gt;&lt;P&gt;However, I get this error message even though the expression validates successfully.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RobertChaney_1-1736443879507.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/123052iDA1BCD3E8D78ECE0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RobertChaney_1-1736443879507.png" alt="RobertChaney_1-1736443879507.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So, I started creating sperate attribute rules for each field that I'm trying to update. This code below updates the PAGEPARCELID field (Map Book Page).&amp;nbsp; It works ok and updates when a change is made to the PARCELID field (Parcel Identification Number field).&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// Get the value from parcelID
var parcelValue = $feature["PARCELID"]

// Find the index of the first space
var spaceIndex = Find(" ", parcelValue)

// Extract all characters before the first space
var mapValue = IIf(spaceIndex != -1, Left(parcelValue, spaceIndex), parcelValue)

// Return the result for the Map field
mapValue&lt;/LI-CODE&gt;&lt;P&gt;The following code updates the BLKLLPARCELID (Block/Landlot Number field) when a change is made to the PARCELID field.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// Get the value from the PIN field and normalize spaces
var pinValue = Trim(Replace($feature["PARCELID"], " +", " "))

// Split the normalized PIN value into parts
var parts = Split(pinValue, "  ")

// Extract the second array element (Block)
var Block = IIf(Count(parts) &amp;gt; 1, parts[1], null)

// Return the Block value
Block&lt;/LI-CODE&gt;&lt;P&gt;When I try to validate this expression to calculate the the LOWPARCELID (Parcel ID Number field) based on the last characters in the Parcel Identification Number field, I get a Unknown function error on line 5.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// Get the value from parcelID and trim leading/trailing spaces
var parcelValue = Trim($feature["PARCELID"])

// Find the index of the last space
var lastSpaceIndex = LastIndexOf(parcelValue, " ")

// Extract all characters after the last space
var LOW = IIf(lastSpaceIndex != -1, Right(parcelValue, TextLength(parcelValue) - lastSpaceIndex - 1), parcelValue)

// Return the result for the LOW field
LOW&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Robert.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2025 17:52:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/calculation-attribute-rule-how-to-account-for/m-p/1574051#M1661</guid>
      <dc:creator>RobertChaney</dc:creator>
      <dc:date>2025-01-09T17:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Attribute Rule: How to account for inconsistent spaces separating values</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/calculation-attribute-rule-how-to-account-for/m-p/1574088#M1662</link>
      <description>&lt;P&gt;you need to use the proper return edits dictionary, more info here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/attribute-rule-dictionary-keywords.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/attribute-rule-dictionary-keywords.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2025 18:57:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/calculation-attribute-rule-how-to-account-for/m-p/1574088#M1662</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2025-01-09T18:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Attribute Rule: How to account for inconsistent spaces separating values</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/calculation-attribute-rule-how-to-account-for/m-p/1574089#M1663</link>
      <description>&lt;P&gt;please do not break this into multiple attribute rules.&amp;nbsp; There is a cost to each rule&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2025 18:57:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/calculation-attribute-rule-how-to-account-for/m-p/1574089#M1663</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2025-01-09T18:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Attribute Rule: How to account for inconsistent spaces separating values</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/calculation-attribute-rule-how-to-account-for/m-p/1574175#M1664</link>
      <description>&lt;P&gt;My goal is to have one single rule.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2025 21:41:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/calculation-attribute-rule-how-to-account-for/m-p/1574175#M1664</guid>
      <dc:creator>RobertChaney</dc:creator>
      <dc:date>2025-01-09T21:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Attribute Rule: How to account for inconsistent spaces separating values</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/calculation-attribute-rule-how-to-account-for/m-p/1576884#M1668</link>
      <description>&lt;P&gt;Based on Mike's comment about the return edits dictionary, I was able to figure that part out.&amp;nbsp; However, looking deeper into the data, I noticed that some of the BLKLLPARCELID fields were blank.&amp;nbsp; So, with the help of ESRI tech support, this is the solution that we ended up with.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// Get the value from ParcelNumber and normalize spaces
// Remove trailling space and extra space
var parcelValue = Trim($feature.PARCELID)

var Maxspace = 10;
var result = 0

for(var z=0; z &amp;lt; Maxspace; z++) {
  parcelValue = Replace(parcelValue, "  ", " ")
}

// Split the normalized ParcelNumber value into parts
var parts = Split(parcelValue, " ")
var Map 
var Block 
var Parcel 
// Extract values for Map, Block, and Parcel
  if ( count(parts) == 2 ) {
    Map = parts[0]
    Block = null
    Parcel = parts[1]
  }
  else if ( count(parts) == 3 ) {
    Map = parts[0]
    Block = parts[1]
    Parcel = parts[2]

  }

 
// Return the results as updated attributes
return {
    "result": {
        "attributes": {
            "PAGEPARCELID": Map,
            "BLKLLPARCELID": Block,
            "LOWPARCELID": parcel
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;Thanks to&amp;nbsp;Nazrita Antasha with ESRI support Services for helping with this attribute rule.&lt;/P&gt;&lt;P&gt;Robert.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2025 18:21:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/calculation-attribute-rule-how-to-account-for/m-p/1576884#M1668</guid>
      <dc:creator>RobertChaney</dc:creator>
      <dc:date>2025-01-17T18:21:04Z</dc:date>
    </item>
  </channel>
</rss>

