<?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 Attribute rule to pass intersecting grid summary into street names table in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-pass-intersecting-grid-summary/m-p/1374610#M1279</link>
    <description>&lt;P&gt;I am trying to summarize multiple road segments with the same name (e.g. Main St) into an array, that I can then write to a single line in a table within the same datastore. I found a similar workflow suggestion by&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;but I do not have a relationship between the road feature class and the master road name table and I am concatenating values in an array instead of summing to a total.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/geodatabase-questions/attribute-rule-isn-t-triggered-when-field-is/td-p/1270013" target="_blank"&gt;https://community.esri.com/t5/geodatabase-questions/attribute-rule-isn-t-triggered-when-field-is/td-p/1270013&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Before this rule runs, there is another rule that Intersects the line segment being created or updated with a grid/map index which is the "IntersectingGrids" field below.&lt;/P&gt;&lt;P&gt;Here's what I have so far:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;/ Get all features with the same LineID
var line_id = $feature.LineID;
var query = "LineID = + @line_id";

var roads = Filter($featureset, query);

// Output array
var grid_arr = [];

// Sort function for later
function grid_sort(a, b){
    if (a &amp;gt; b){
        return 1;
    } else {
        return -1;
    }
}

// Check if records exist
if (Count(roads) &amp;gt; 0) {
    
    for (var row in roads) {
        
        // split value by commas
        var items = Split(row.IntersectingGrids, ',', -1, true);
        
        for (var i in items) {
            
            // trim any whitespace    
            var grid_value = Trim(items[i]);
            
            // Check if grid value already in array
            if (Find(grid_value, grid_arr) == -1){
                
                // Add to array
                Push(grid_arr, grid_value);
            }
        }
    }
    
    // Sort grid_arr with custom sort function
    var sorted = Concatenate(Sort(grid_arr, grid_sort), ', ');
} else {
    return 'No records.';
}

var lineListExpression =;
var lineListFeatures = FeatureSetByName($datastore, 'Line_List', ['GridList1'], false);

var features = Filter(lineListFeatures,  "LineID = '" + line_id + "'")&lt;/LI-CODE&gt;&lt;P&gt;But I am not sure where to go after that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a batch attribute rule in the Line_List table that works, although it does not update if there is already something in the field. Ideally, when a change is made to a road segment (geometry edit or road name change), the GridList field in the master road names table would automatically update.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;//This batch rule is saved in the Line_List table and works to summarize the various line segments and group them by LineID, then produce a summary array, but it does not update when changes are made to the road segments in the feature class.

// Output array
var grid_arr = []

// Sort function for later
function grid_sort(a, b){
    if (a &amp;gt; b){
        return 1
    } else {
        return -1
    }
}

var lineID = $feature.LineID


// Get related records
var segments = FeatureSetByName($datastore, "Line", ['LineID', 'Test_txt'], false)
var segment_data = Filter(segments, "lineID = '" + $feature.LineID + "'")

// Check if related records exist
if(Count(segment_data) &amp;gt; 0){
    
    for (var row in segment_data){
        
        // split value by commas
        var items = Split(row.Test_txt, ',', -1, true)
        
        for (var i in items){
        
            // trim any whitespace    
            var grid_value = Trim(items[i])
            
            // Check if grid value already in array
            if (Find(grid_value, grid_arr) == -1){
            
                // Add to array
                Push(grid_arr, grid_value)
            }
        }
    }
    
    // Sort grid_arr with custom sort function
    var sorted = Sort(grid_arr, grid_sort)

    // Return concatenated string of array values
    return Concatenate(sorted, ', ')
} else {
    return 'No records.'
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 25 Jan 2024 19:28:32 GMT</pubDate>
    <dc:creator>bbaker_tngeo</dc:creator>
    <dc:date>2024-01-25T19:28:32Z</dc:date>
    <item>
      <title>Attribute rule to pass intersecting grid summary into street names table</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-pass-intersecting-grid-summary/m-p/1374610#M1279</link>
      <description>&lt;P&gt;I am trying to summarize multiple road segments with the same name (e.g. Main St) into an array, that I can then write to a single line in a table within the same datastore. I found a similar workflow suggestion by&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;but I do not have a relationship between the road feature class and the master road name table and I am concatenating values in an array instead of summing to a total.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/geodatabase-questions/attribute-rule-isn-t-triggered-when-field-is/td-p/1270013" target="_blank"&gt;https://community.esri.com/t5/geodatabase-questions/attribute-rule-isn-t-triggered-when-field-is/td-p/1270013&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Before this rule runs, there is another rule that Intersects the line segment being created or updated with a grid/map index which is the "IntersectingGrids" field below.&lt;/P&gt;&lt;P&gt;Here's what I have so far:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;/ Get all features with the same LineID
var line_id = $feature.LineID;
var query = "LineID = + @line_id";

var roads = Filter($featureset, query);

// Output array
var grid_arr = [];

// Sort function for later
function grid_sort(a, b){
    if (a &amp;gt; b){
        return 1;
    } else {
        return -1;
    }
}

// Check if records exist
if (Count(roads) &amp;gt; 0) {
    
    for (var row in roads) {
        
        // split value by commas
        var items = Split(row.IntersectingGrids, ',', -1, true);
        
        for (var i in items) {
            
            // trim any whitespace    
            var grid_value = Trim(items[i]);
            
            // Check if grid value already in array
            if (Find(grid_value, grid_arr) == -1){
                
                // Add to array
                Push(grid_arr, grid_value);
            }
        }
    }
    
    // Sort grid_arr with custom sort function
    var sorted = Concatenate(Sort(grid_arr, grid_sort), ', ');
} else {
    return 'No records.';
}

var lineListExpression =;
var lineListFeatures = FeatureSetByName($datastore, 'Line_List', ['GridList1'], false);

var features = Filter(lineListFeatures,  "LineID = '" + line_id + "'")&lt;/LI-CODE&gt;&lt;P&gt;But I am not sure where to go after that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a batch attribute rule in the Line_List table that works, although it does not update if there is already something in the field. Ideally, when a change is made to a road segment (geometry edit or road name change), the GridList field in the master road names table would automatically update.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;//This batch rule is saved in the Line_List table and works to summarize the various line segments and group them by LineID, then produce a summary array, but it does not update when changes are made to the road segments in the feature class.

// Output array
var grid_arr = []

// Sort function for later
function grid_sort(a, b){
    if (a &amp;gt; b){
        return 1
    } else {
        return -1
    }
}

var lineID = $feature.LineID


// Get related records
var segments = FeatureSetByName($datastore, "Line", ['LineID', 'Test_txt'], false)
var segment_data = Filter(segments, "lineID = '" + $feature.LineID + "'")

// Check if related records exist
if(Count(segment_data) &amp;gt; 0){
    
    for (var row in segment_data){
        
        // split value by commas
        var items = Split(row.Test_txt, ',', -1, true)
        
        for (var i in items){
        
            // trim any whitespace    
            var grid_value = Trim(items[i])
            
            // Check if grid value already in array
            if (Find(grid_value, grid_arr) == -1){
            
                // Add to array
                Push(grid_arr, grid_value)
            }
        }
    }
    
    // Sort grid_arr with custom sort function
    var sorted = Sort(grid_arr, grid_sort)

    // Return concatenated string of array values
    return Concatenate(sorted, ', ')
} else {
    return 'No records.'
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2024 19:28:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-pass-intersecting-grid-summary/m-p/1374610#M1279</guid>
      <dc:creator>bbaker_tngeo</dc:creator>
      <dc:date>2024-01-25T19:28:32Z</dc:date>
    </item>
  </channel>
</rss>

