<?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: Use of Arcade featureSetByAssociation in ArcGIS Utility Network Questions</title>
    <link>https://community.esri.com/t5/arcgis-utility-network-questions/use-of-arcade-featuresetbyassociation/m-p/1558534#M4524</link>
    <description>&lt;P&gt;The result of FSbyAssociation is a table.&amp;nbsp; You can get the pole GlobalID from that table to query the pole layer to get the pole.&amp;nbsp; Take a look at the function below(from&amp;nbsp;&lt;A href="https://github.com/Esri/arcade-expressions/blob/master/attribute-rules/attribute_rule_calculation/UpdateAssociatedFeatures.md" target="_blank"&gt;https://github.com/Esri/arcade-expressions/blob/master/attribute-rules/attribute_rule_calculation/UpdateAssociatedFeatures.md&lt;/A&gt;)&lt;/P&gt;
&lt;P&gt;Please post code as a code sample&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;function get_associated_feature_ids(feature, association_type) {
    // Query to get all the content associations
    var associations = FeatureSetByAssociation(feature, association_type);
    // If there is no content, exit the function
    if (count(associations) == 0) {
        return null;
    }
    // loop over all associated records to get a list of the associated classes and the IDs of the features
    var associated_ids = {};
    for (var row in associations) {
        if (HasKey(associated_ids, row.className) == false) {
            associated_ids[row.className] = [];
        }
        associated_ids[row.className][Count(associated_ids[row.className])] = row.globalId;
    }
    //return a dict by class name with GlobalIDs of features
    return associated_ids;
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Nov 2024 10:36:05 GMT</pubDate>
    <dc:creator>MikeMillerGIS</dc:creator>
    <dc:date>2024-11-14T10:36:05Z</dc:date>
    <item>
      <title>Use of Arcade featureSetByAssociation</title>
      <link>https://community.esri.com/t5/arcgis-utility-network-questions/use-of-arcade-featuresetbyassociation/m-p/1334392#M2901</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm struggling with the use of featureSetByAssociation in an attribute rule&lt;/P&gt;&lt;P&gt;What I'm trying to do is select the features attached to a pole, then count individual assetGroups. But I can't find how to use the className result of fsByAssociation function.&lt;/P&gt;&lt;P&gt;The documentation says it returns :&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;className&lt;/STRONG&gt;: &lt;A href="https://developers.arcgis.com/arcade/guide/types/#text" target="_blank" rel="noopener"&gt;Text&lt;/A&gt; - The class name based on the value of TONETWORKSOURCEID or FROMNETWORKSOURCEID.&lt;/P&gt;&lt;P&gt;First, how do I know if I am querying TO or FROM field ?&lt;/P&gt;&lt;P&gt;Second, how do I know how to format the query ?&lt;/P&gt;&lt;P&gt;Looking here (&lt;A href="https://pro.arcgis.com/fr/pro-app/latest/help/data/geodatabases/overview/attribute-rule-dictionary-keywords.htm" target="_blank" rel="noopener"&gt;https://pro.arcgis.com/fr/pro-app/latest/help/data/geodatabases/overview/attribute-rule-dictionary-keywords.htm&lt;/A&gt;) I see several query formatting (electricdistributionassembly, StructureJunctionObject...)&lt;/P&gt;&lt;P&gt;Looking here (&lt;A href="https://www.esri.com/arcgis-blog/products/utility-network/data-management/featuresetbyassocaitions-new-utility-network-arcade-api-to-work-with-associations-2-5-10-8/" target="_blank" rel="noopener"&gt;https://www.esri.com/arcgis-blog/products/utility-network/data-management/featuresetbyassocaitions-new-utility-network-arcade-api-to-work-with-associations-2-5-10-8/&lt;/A&gt;) they tell&lt;/P&gt;&lt;P&gt;`className:` String based on value of (TONETWORKSOURCEID or FROMNETWORKSOURCEID )&lt;/P&gt;&lt;P&gt;Ex : var devicesRows = Filter(allContent, "className = 'Electric Device'")&lt;/P&gt;&lt;P&gt;But when looking at the Assicoation View in ArcGIS Pro, I have 4 or 12 as values for FROM/TONETWORKSOURCEID&lt;/P&gt;&lt;P&gt;Any help is welcome&lt;/P&gt;&lt;P&gt;Note that I am working in a mobile geotatabase&lt;/P&gt;&lt;P&gt;Also, if anyone has info about how to user &lt;STRONG&gt;terminalName&lt;/STRONG&gt;&amp;nbsp; in the same function...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 06:20:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-utility-network-questions/use-of-arcade-featuresetbyassociation/m-p/1334392#M2901</guid>
      <dc:creator>PierreloupDucroix</dc:creator>
      <dc:date>2023-10-03T06:20:45Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Arcade featureSetByAssociation</title>
      <link>https://community.esri.com/t5/arcgis-utility-network-questions/use-of-arcade-featuresetbyassociation/m-p/1334433#M2902</link>
      <description>&lt;P&gt;Classname is converted from the SourceID to the SourceName.&amp;nbsp; In mobile GDB, I am pretty sure it will be main.ElectricDevice for example.&lt;/P&gt;&lt;P&gt;Classname represents either the from or to.&amp;nbsp; So in a containment and your feature is content, it will be the From, since containment associations are always From(Container), To(Content).&amp;nbsp; But for Junction Junction, the From/To does not matter.&amp;nbsp; So if you feature is on the From side, the Classname represents the To.&amp;nbsp; So, ignore the fact that there is a from/to in the association table, FSbyAssocation returns all associations(filtered by type if passed in) to the feature and the name of the associated item.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TerminalName is the name of the terminal, not the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want the codes, you will have to create a query to a FeatureSet on the association table.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 07:16:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-utility-network-questions/use-of-arcade-featuresetbyassociation/m-p/1334433#M2902</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2023-10-03T07:16:02Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Arcade featureSetByAssociation</title>
      <link>https://community.esri.com/t5/arcgis-utility-network-questions/use-of-arcade-featuresetbyassociation/m-p/1334511#M2903</link>
      <description>&lt;P&gt;If all you want is the attachments, you can just pass in the feature and the association type ("attachment"). You only need to pass in the other information if you want to be more specific about the types of associations returned.&lt;/P&gt;&lt;P&gt;You can find many example arcade expressions in the following github repository from Esri (&lt;A href="https://github.com/Esri/arcade-expressions/tree/master" target="_blank"&gt;Esri/arcade-expressions: ArcGIS Arcade expression templates for all supported profiles in the ArcGIS platform. (github.com)&lt;/A&gt;). There are 16 rules that include examples of using the featureSetByAssociation command and while most of them only pass in the feature and the association type you can find one example that makes use of the class name parameter here (although as I said I think you can use the simpler form of the function):&amp;nbsp;&lt;A href="https://github.com/Esri/arcade-expressions/blob/801d086d4bdc6ad10ebb9c7fde9fdc7b4717a9c6/popup/has_proposed_features.md?plain=1#L25" target="_blank"&gt;arcade-expressions/popup/has_proposed_features.md at 801d086d4bdc6ad10ebb9c7fde9fdc7b4717a9c6 · Esri/arcade-expressions (github.com)&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 13:34:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-utility-network-questions/use-of-arcade-featuresetbyassociation/m-p/1334511#M2903</guid>
      <dc:creator>RobertKrisher</dc:creator>
      <dc:date>2023-10-03T13:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Arcade featureSetByAssociation</title>
      <link>https://community.esri.com/t5/arcgis-utility-network-questions/use-of-arcade-featuresetbyassociation/m-p/1334785#M2907</link>
      <description>&lt;P&gt;Hi Mike and Robert,&lt;/P&gt;&lt;P&gt;What I want to do is count each AssetGroup's features within my associations :&lt;/P&gt;&lt;P&gt;Ex : for "attached" feature of a pole, I need to count how many streetlights, LV connection points and MV connection points. At first, I understood that the ClassName represented the ASSETGROUP and not the Layer.&lt;/P&gt;&lt;P&gt;I ended up getting the globaIDs from the FSbyAssociation in a list, and filtering a featureSetByName with those GIDs and the proper ASSETGROUPs. Then counting the results.&lt;/P&gt;&lt;P&gt;Robert, in the second link you provided, what are the parameters after the association_type ? They are not provided in the Arcade documentation.&lt;/P&gt;&lt;P&gt;--&amp;gt; var associations = FeatureSetByAssociation(feature, association_type, &lt;STRONG&gt;null, null,&lt;/STRONG&gt; ['className'], &lt;STRONG&gt;false&lt;/STRONG&gt;);&lt;/P&gt;&lt;P&gt;Mike, anyway it doesn't seem to work in a mobile geodatabase.&lt;/P&gt;&lt;P&gt;Ex without classname :&lt;/P&gt;&lt;P&gt;var assoList = featureSetByAssociation(eqpt, "attached")&lt;BR /&gt;console(count(assoList)) --&amp;gt; 3&lt;/P&gt;&lt;P&gt;with className :&lt;/P&gt;&lt;P&gt;var assoList = filter(featureSetByAssociation(eqpt, "attached"), "className = 'main.ElectricDevice'"),&lt;BR /&gt;console(count(assoList))&lt;/P&gt;&lt;P&gt;--&amp;gt; No result, no console log&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 22:01:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-utility-network-questions/use-of-arcade-featuresetbyassociation/m-p/1334785#M2907</guid>
      <dc:creator>PierreloupDucroix</dc:creator>
      <dc:date>2023-10-03T22:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Arcade featureSetByAssociation</title>
      <link>https://community.esri.com/t5/arcgis-utility-network-questions/use-of-arcade-featuresetbyassociation/m-p/1334787#M2908</link>
      <description>&lt;P&gt;In a file geodatabase the class name will not be qualified&lt;/P&gt;&lt;P&gt;var assoList = featureSetByAssociation($feature, "attached");&lt;BR /&gt;for(var asso in assoList)&lt;BR /&gt;console(asso);&lt;/P&gt;&lt;P&gt;produces the correct result in a mobile geodatabase, but doesn't work in a file geodatabase. Here's an example of a result from a mobile geodatabase.&lt;/P&gt;&lt;P&gt;{"geometry":null,"attributes":{"className":"ElectricJunction","globalId":"{0B531F4D-3886-4C8E-B4C0-2D85B8F7A7D1}","isContentVisible":0,"ObjectID":8730,"OID":8730,"percentAlong":0,"side":"","terminal":-1}}&lt;/P&gt;&lt;P&gt;A "Mobile Geodatabase" is a sqllite database that is stored in a single *.geodatabase file. A File Geodatabase is a file-based structure contained in a folder with a .gdb extension.&lt;/P&gt;&lt;P&gt;In a file geodatabase, I was able to get this expression to produce a result when a structure has a junction attached:&lt;/P&gt;&lt;P&gt;var assoList = featureSetByAssociation($feature, "attached");&lt;BR /&gt;for(var asso in assoList)&lt;BR /&gt;console(asso);&lt;/P&gt;&lt;P&gt;var filterList = Filter(assoList, "className = 'main.ElectricJunction'");&lt;BR /&gt;console(count(filterList));&lt;/P&gt;&lt;P&gt;return count(filterList)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RobertKrisher_0-1696371410762.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/82252i1F23AE74F489FE55/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RobertKrisher_0-1696371410762.png" alt="RobertKrisher_0-1696371410762.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 22:16:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-utility-network-questions/use-of-arcade-featuresetbyassociation/m-p/1334787#M2908</guid>
      <dc:creator>RobertKrisher</dc:creator>
      <dc:date>2023-10-03T22:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Arcade featureSetByAssociation</title>
      <link>https://community.esri.com/t5/arcgis-utility-network-questions/use-of-arcade-featuresetbyassociation/m-p/1334794#M2911</link>
      <description>&lt;P&gt;Thank you very much for these explanations and examples.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 22:41:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-utility-network-questions/use-of-arcade-featuresetbyassociation/m-p/1334794#M2911</guid>
      <dc:creator>PierreloupDucroix</dc:creator>
      <dc:date>2023-10-03T22:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Arcade featureSetByAssociation</title>
      <link>https://community.esri.com/t5/arcgis-utility-network-questions/use-of-arcade-featuresetbyassociation/m-p/1557229#M4509</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/188597"&gt;@MikeMillerGIS&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/138089"&gt;@RobertKrisher&lt;/a&gt;&amp;nbsp;, can we use featureSetByAssociation on electricdevice to read the associated structurejunction(pole)? I see examples here to do the opposites here: &lt;A href="https://www.esri.com/arcgis-blog/products/utility-network/data-management/featuresetbyassocaitions-new-utility-network-arcade-api-to-work-with-associations-2-5-10-8/" target="_self"&gt;https://www.esri.com/arcgis-blog/products/utility-network/data-management/featuresetbyassocaitions-new-utility-network-arcade-api-to-work-with-associations-2-5-10-8/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I basically want to read the uniqueid of the attached pole and populate an attribute value of electric device with the same. Any lead would be really helpful. Thank you in advance!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Nov 2024 10:00:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-utility-network-questions/use-of-arcade-featuresetbyassociation/m-p/1557229#M4509</guid>
      <dc:creator>Reeti_05</dc:creator>
      <dc:date>2024-11-11T10:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Arcade featureSetByAssociation</title>
      <link>https://community.esri.com/t5/arcgis-utility-network-questions/use-of-arcade-featuresetbyassociation/m-p/1557230#M4510</link>
      <description>&lt;P&gt;Yes, you would use "Structure"&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;“&lt;/SPAN&gt;&lt;STRONG&gt;structure&lt;/STRONG&gt;&lt;SPAN&gt;” – will return the feature the specified feature is attached to through a structural attachment association&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Nov 2024 09:51:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-utility-network-questions/use-of-arcade-featuresetbyassociation/m-p/1557230#M4510</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2024-11-11T09:51:11Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Arcade featureSetByAssociation</title>
      <link>https://community.esri.com/t5/arcgis-utility-network-questions/use-of-arcade-featuresetbyassociation/m-p/1557268#M4511</link>
      <description>&lt;P&gt;Thank you &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/188597"&gt;@MikeMillerGIS&lt;/a&gt;&amp;nbsp;, I am using a code to get my elecdevice associated with a nearby Pole(structure junction). The code am using is here:&amp;nbsp;&lt;A href="https://github.com/Esri/arcade-expressions/blob/master/attribute-rules/attribute_rule_calculation/CreateAttachmentAssociationByProximity.md" target="_blank" rel="noopener"&gt;https://github.com/Esri/arcade-expressions/blob/master/attribute-rules/attribute_rule_calculation/CreateAttachmentAssociationByProximity.md&lt;/A&gt;&amp;nbsp; that works alright. When am adding another AT rule:&amp;nbsp;&lt;/P&gt;&lt;P&gt;var fs = featuresetbyassociation($feature, "structure")&lt;BR /&gt;var polecount= count(fs);&lt;BR /&gt;return polecount;&lt;/P&gt;&lt;P&gt;This is returning 1 item.&lt;/P&gt;&lt;P&gt;Next am trying to read an uniqueid from the structure:&amp;nbsp;&lt;/P&gt;&lt;P&gt;var fs = featuresetbyassociation($feature, "structure")&lt;BR /&gt;//var polecount= count(fs);&lt;BR /&gt;//return polecount;&lt;/P&gt;&lt;P&gt;var buf = Buffer($feature, 8, "feet");&lt;BR /&gt;var fs_filtered = Intersects(fs, buf);&lt;BR /&gt;var cnt = Count(fs_filtered);&lt;BR /&gt;var min_dist = 999;&lt;BR /&gt;var nearest_uniquefid = 0;&lt;/P&gt;&lt;P&gt;if (cnt &amp;gt; 0) {&lt;BR /&gt;for (var f in fs_filtered) {&lt;BR /&gt;var dist = Distance($feature, f);&lt;BR /&gt;if (dist &amp;lt; min_dist) {&lt;BR /&gt;min_dist = dist;&lt;BR /&gt;nearest_uniquefid = f.uniquefid; // Assuming 'uniquefid' is the field name&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;return nearest_uniquefid;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I know this works if i use it as featuresetbyname($datastore, "structurejunction") but not being able to make it work with efaturesetbyassociation, any lead would be helpful!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Nov 2024 15:40:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-utility-network-questions/use-of-arcade-featuresetbyassociation/m-p/1557268#M4511</guid>
      <dc:creator>Reeti_05</dc:creator>
      <dc:date>2024-11-11T15:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Arcade featureSetByAssociation</title>
      <link>https://community.esri.com/t5/arcgis-utility-network-questions/use-of-arcade-featuresetbyassociation/m-p/1558534#M4524</link>
      <description>&lt;P&gt;The result of FSbyAssociation is a table.&amp;nbsp; You can get the pole GlobalID from that table to query the pole layer to get the pole.&amp;nbsp; Take a look at the function below(from&amp;nbsp;&lt;A href="https://github.com/Esri/arcade-expressions/blob/master/attribute-rules/attribute_rule_calculation/UpdateAssociatedFeatures.md" target="_blank"&gt;https://github.com/Esri/arcade-expressions/blob/master/attribute-rules/attribute_rule_calculation/UpdateAssociatedFeatures.md&lt;/A&gt;)&lt;/P&gt;
&lt;P&gt;Please post code as a code sample&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;function get_associated_feature_ids(feature, association_type) {
    // Query to get all the content associations
    var associations = FeatureSetByAssociation(feature, association_type);
    // If there is no content, exit the function
    if (count(associations) == 0) {
        return null;
    }
    // loop over all associated records to get a list of the associated classes and the IDs of the features
    var associated_ids = {};
    for (var row in associations) {
        if (HasKey(associated_ids, row.className) == false) {
            associated_ids[row.className] = [];
        }
        associated_ids[row.className][Count(associated_ids[row.className])] = row.globalId;
    }
    //return a dict by class name with GlobalIDs of features
    return associated_ids;
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 10:36:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-utility-network-questions/use-of-arcade-featuresetbyassociation/m-p/1558534#M4524</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2024-11-14T10:36:05Z</dc:date>
    </item>
  </channel>
</rss>

