<?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: Attribute Rule for Location Description in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-for-location-description/m-p/1040579#M109</link>
    <description>&lt;P&gt;Something like this?&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;return closest_address.street_name + " " + closest_address.house_number + ", " + closest_address.zip_code + " " + closest_address.town_name&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or for better readability:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var street = closest_address.street_name
var house = closest_address.house_number
var zip = closest_address.zip_code
var town = closest_address.town_name
return street + " " + house + ", " + zip + " " + town&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I haven't figured out calling feature attributes by variables, yet:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// These work:
return $feature.Attribute
return $feature["Attribute"]

// This doesn't (in my experience):
var att = "Attribute"
return $feature[att]

// When working with features that aren't $feature (e.g. your closest_address), only this seems to work:
var f = First(Intersect(FeatureSetByName(...), $feature))
return f.Attribute&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 25 Mar 2021 13:31:17 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2021-03-25T13:31:17Z</dc:date>
    <item>
      <title>Attribute Rule for Location Description</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-for-location-description/m-p/1040569#M108</link>
      <description>&lt;P&gt;Our organization is working on migrating to ArcGIS Pro and the new Utility Network. I am working on replicating Attribute Assistant functions with the new Attribute Rules in a test environment.&lt;/P&gt;&lt;P&gt;We have a location description field in all of our utility data that populates the nearest address when a feature is created. I am trying to replicate this function with Attribute rules. Attribute assistant based it on an address centerline file. I am trying to base it off situs points for my first try at the automation.&lt;/P&gt;&lt;P&gt;I am able to grab the nearest address but only one field. For some reason it wont concatenate. If I try to get is to return more than one field I get an error. I have tried concatenate in both the variable and results and about 50 other ridiculous ways to get it to work.&lt;/P&gt;&lt;P&gt;Here is the code that gives me the nearest "street" value. If I try to call and concatenate any other fields I get an error.&lt;/P&gt;&lt;P&gt;So I need the several fields from the intersected layer concatenated together to have a coherent address for my LOCDESC field&lt;/P&gt;&lt;PRE class="lang-js s-code-block hljs javascript"&gt;&lt;SPAN class="hljs-keyword"&gt;var&lt;/SPAN&gt; situs_address = &lt;SPAN class="hljs-string"&gt;"street_name"&lt;/SPAN&gt;;

&lt;SPAN class="hljs-keyword"&gt;var&lt;/SPAN&gt; feature_field = $feature.LOCDESC;

&lt;SPAN class="hljs-keyword"&gt;var&lt;/SPAN&gt; address = featuresetbyname($datastore, &lt;SPAN class="hljs-string"&gt;'situs'&lt;/SPAN&gt;);
&lt;SPAN class="hljs-comment"&gt;//set some variables, tried to concatenate in var = situs_address, arcade does not like that//&lt;/SPAN&gt;

&lt;SPAN class="hljs-keyword"&gt;var&lt;/SPAN&gt; closest_address = first(intersects( address, Buffer($feature, &lt;SPAN class="hljs-number"&gt;500&lt;/SPAN&gt;, &lt;SPAN class="hljs-string"&gt;'feet'&lt;/SPAN&gt;)));
&lt;SPAN class="hljs-comment"&gt;// this is the meat and potatoes of the operation//&lt;/SPAN&gt;

&lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt; (closest_address == &lt;SPAN class="hljs-literal"&gt;null&lt;/SPAN&gt;)
{
&lt;SPAN class="hljs-keyword"&gt;return&lt;/SPAN&gt; $feature.locdesc;
}
&lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt; (isempty(closest_address.street_name))
{
&lt;SPAN class="hljs-keyword"&gt;return&lt;/SPAN&gt; $feature[feature_field];
}
&lt;SPAN class="hljs-comment"&gt;//takes care of the null values//&lt;/SPAN&gt;

&lt;SPAN class="hljs-keyword"&gt;return&lt;/SPAN&gt; closest_address[situs_address];
&lt;SPAN class="hljs-comment"&gt;// tried all sorts of combinations here, tried adding variables for each feature i need and &lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Mar 2021 13:08:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-for-location-description/m-p/1040569#M108</guid>
      <dc:creator>James_Norquest</dc:creator>
      <dc:date>2021-03-25T13:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule for Location Description</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-for-location-description/m-p/1040579#M109</link>
      <description>&lt;P&gt;Something like this?&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;return closest_address.street_name + " " + closest_address.house_number + ", " + closest_address.zip_code + " " + closest_address.town_name&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or for better readability:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var street = closest_address.street_name
var house = closest_address.house_number
var zip = closest_address.zip_code
var town = closest_address.town_name
return street + " " + house + ", " + zip + " " + town&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I haven't figured out calling feature attributes by variables, yet:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// These work:
return $feature.Attribute
return $feature["Attribute"]

// This doesn't (in my experience):
var att = "Attribute"
return $feature[att]

// When working with features that aren't $feature (e.g. your closest_address), only this seems to work:
var f = First(Intersect(FeatureSetByName(...), $feature))
return f.Attribute&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 25 Mar 2021 13:31:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-for-location-description/m-p/1040579#M109</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2021-03-25T13:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule for Location Description</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-for-location-description/m-p/1040589#M110</link>
      <description>&lt;P&gt;Johannes, Thank you so much, it works perfectly. I was overcomplicating it and didn't even need to use the concatenate function. Next I need to look at pulling the address number from a centerline file as it was done with attribute assistant.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This helps so much!&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 13:56:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-for-location-description/m-p/1040589#M110</guid>
      <dc:creator>James_Norquest</dc:creator>
      <dc:date>2021-03-25T13:56:46Z</dc:date>
    </item>
  </channel>
</rss>

