<?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: Expression using FeatureSet to add contextual data from another layer in pop-up not returning results in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/expression-using-featureset-to-add-contextual-data/m-p/1058065#M40065</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created an AGOL group - FROHR Private and invited you join. I have shared the UCF Tree Inspections layer and the CAL FIRE UCF Tree Data layer with this group. Both are views but should work for you.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I made the small changes to the expression and, as you expected, continue to get a return of&amp;nbsp; 'No inspections' for every tree point.&lt;/P&gt;&lt;P&gt;I appreciate your help on this. Francesca&lt;/P&gt;</description>
    <pubDate>Fri, 14 May 2021 15:48:27 GMT</pubDate>
    <dc:creator>FPGIS_FrancescaRohr</dc:creator>
    <dc:date>2021-05-14T15:48:27Z</dc:date>
    <item>
      <title>Expression using FeatureSet to add contextual data from another layer in pop-up not returning results</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/expression-using-featureset-to-add-contextual-data/m-p/1056386#M39969</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am customizing the pop-up on my main layer (layer A) in a web map and want to include information from a separate layer (layer B). Both layers are point features. Layer A is tree points and Layer B is inspections on those trees, one inspection per tree. Not all trees have inspections. However, my expression is not returning the desired results.&lt;/P&gt;&lt;P&gt;Line 1 of my expression creates a unique id from two fields in layer A:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;var treeuniqueid = Text($feature["Grant_ID"]+"_"+$feature["Tree_ID"])&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Line 2 of my expression uses FeatureSetByName to access the attributes from layer B:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;var inspection = FeatureSetByName($map,"UCF Tree Inspections - UCF Tree Inspections")&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Line 3 adds in a filterStatement to match the records in layers A &amp;amp; B:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;var filterStatement = "Tree_UniqueID = @treeuniqueid"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Lines 4&amp;amp;5 use Filter to only return the information for the selected tree point in the web map.&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;var inspected = Filter(inspection, filterStatement)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;return inspected&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;In the expression window the results show that I am accessing layer B attributes:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FPGIS_FrancescaRohr_0-1620674078147.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/12990i5D8D4AD319CF9533/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FPGIS_FrancescaRohr_0-1620674078147.png" alt="FPGIS_FrancescaRohr_0-1620674078147.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;but I get this in the pop-up itself:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FPGIS_FrancescaRohr_1-1620674209549.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/12991iC6477F9F60715F7A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FPGIS_FrancescaRohr_1-1620674209549.png" alt="FPGIS_FrancescaRohr_1-1620674209549.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Is using the created variable treeuniqueid to essentially 'join' the tables from the two layers an issue?&lt;/P&gt;&lt;P&gt;What else am I missing? Any and all help appreciated. Thank you, Francesca&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 19:20:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/expression-using-featureset-to-add-contextual-data/m-p/1056386#M39969</guid>
      <dc:creator>FPGIS_FrancescaRohr</dc:creator>
      <dc:date>2021-05-10T19:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: Expression using FeatureSet to add contextual data from another layer in pop-up not returning results</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/expression-using-featureset-to-add-contextual-data/m-p/1056911#M40007</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/387594"&gt;@FPGIS_FrancescaRohr&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;The problem, in this case, is that you are returning a featureset to the pop-up. That is something the pop-up can't visualize. It does show in the expression builder, but this does not mean that it will show in the pop-up. You will probably have to loop through the features in the featureset and construct the text that you want to return.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have a look at&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-online-documents/using-featuresetby-functions-in-arcade-to-drill-down-to-other/ta-p/918691" target="_blank"&gt;https://community.esri.com/t5/arcgis-online-documents/using-featuresetby-functions-in-arcade-to-drill-down-to-other/ta-p/918691&lt;/A&gt;&amp;nbsp;and the second code block where a list of maintenances of a hydrant is formatted and returned to the pop-up.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 May 2021 21:59:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/expression-using-featureset-to-add-contextual-data/m-p/1056911#M40007</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-05-11T21:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: Expression using FeatureSet to add contextual data from another layer in pop-up not returning results</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/expression-using-featureset-to-add-contextual-data/m-p/1057688#M40047</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the article link, it was very helpful. I simplified the expression from the article and customized it to work for my data:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;var inspections = FeatureSetByName($map,"UCF Tree Inspections - UCF Tree Inspections")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;var treeuniqueid = Text($feature["Grant_ID"]+"_"+$feature["Tree_ID"])&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;var sql = "Tree_UniqueID = @treeuniqueid"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;Console(sql)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;var inspection = Filter(inspections, sql)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;var cnt = Count(inspection)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;var history = ""&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;if (cnt &amp;gt; 0){&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;history = cnt + "inspection(s):"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;else {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;history = "No inspections"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;return history&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I changed var sql from:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;var sql = "Tree_UniqueID = '" + treeuniqueid + "'"&amp;nbsp;&lt;FONT color="#000000"&gt;to:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;var sql = "Tree_UniqueID = @treeuniqueid"&amp;nbsp;&lt;FONT color="#000000"&gt;because I wasn't getting any return in my pop-up. Now I get 'No inspections' even when an inspection has occurred. Obviously var sql line is incorrect. I followed the example given for attribute related data in&amp;nbsp;&lt;A href="https://www.esri.com/arcgis-blog/products/arcgis-online/data-management/pump-up-your-pop-ups-with-arcade-and-the-living-atlas/" target="_blank"&gt;https://www.esri.com/arcgis-blog/products/arcgis-online/data-management/pump-up-your-pop-ups-with-arcade-and-the-living-atlas/&lt;/A&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FPGIS_FrancescaRohr_0-1620922904299.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/13272i64962D609C0AFD91/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FPGIS_FrancescaRohr_0-1620922904299.png" alt="FPGIS_FrancescaRohr_0-1620922904299.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I can't find any specific documentation on how to successfully create this variable. It's difficult to know the limits of Arcade - is there an issue with using a created variable as the 'field' on which to match (join) two data layers?&amp;nbsp; My hope is that I just haven't learned how to do it yet.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 16:33:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/expression-using-featureset-to-add-contextual-data/m-p/1057688#M40047</guid>
      <dc:creator>FPGIS_FrancescaRohr</dc:creator>
      <dc:date>2021-05-13T16:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: Expression using FeatureSet to add contextual data from another layer in pop-up not returning results</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/expression-using-featureset-to-add-contextual-data/m-p/1057724#M40048</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/387594"&gt;@FPGIS_FrancescaRohr&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Quick question: does your data use a Relationshipclass? If so, you are probably better off using the "FeatureSetByRelationshipName" to get to the related records.&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 17:50:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/expression-using-featureset-to-add-contextual-data/m-p/1057724#M40048</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-05-13T17:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: Expression using FeatureSet to add contextual data from another layer in pop-up not returning results</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/expression-using-featureset-to-add-contextual-data/m-p/1057748#M40049</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No, the inspections are not a related table to the tree data.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 18:30:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/expression-using-featureset-to-add-contextual-data/m-p/1057748#M40049</guid>
      <dc:creator>FPGIS_FrancescaRohr</dc:creator>
      <dc:date>2021-05-13T18:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: Expression using FeatureSet to add contextual data from another layer in pop-up not returning results</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/expression-using-featureset-to-add-contextual-data/m-p/1057928#M40058</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/387594"&gt;@FPGIS_FrancescaRohr&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Sorry for the delay, but I was in meetings all afternoon. I was looking at the expression and I can't see any problem with it. I assume as you do that it concerns the SQL. I think you are creating it correctly, but I can't validate without having access to the data. In case possible, can you share the data? You could create a group, share the data to that group and invite me using "xbakker.spx" to the group.&lt;/P&gt;&lt;P&gt;Some minor changes to your expression, but none that will solve the issue.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var inspections = FeatureSetByName($map, "UCF Tree Inspections - UCF Tree Inspections");
var treeuniqueid = $feature["Grant_ID"] + "_" + $feature["Tree_ID"];
var sql = "Tree_UniqueID = @treeuniqueid";
Console(sql);

var inspection = Filter(inspections, sql);
var cnt = Count(inspection);
var history = "";

if (cnt &amp;gt; 0) {
    history = "inspection(s): " + cnt;
} else {
    history = "No inspections";
}

return history;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 23:17:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/expression-using-featureset-to-add-contextual-data/m-p/1057928#M40058</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-05-13T23:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: Expression using FeatureSet to add contextual data from another layer in pop-up not returning results</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/expression-using-featureset-to-add-contextual-data/m-p/1058065#M40065</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created an AGOL group - FROHR Private and invited you join. I have shared the UCF Tree Inspections layer and the CAL FIRE UCF Tree Data layer with this group. Both are views but should work for you.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I made the small changes to the expression and, as you expected, continue to get a return of&amp;nbsp; 'No inspections' for every tree point.&lt;/P&gt;&lt;P&gt;I appreciate your help on this. Francesca&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 15:48:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/expression-using-featureset-to-add-contextual-data/m-p/1058065#M40065</guid>
      <dc:creator>FPGIS_FrancescaRohr</dc:creator>
      <dc:date>2021-05-14T15:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: Expression using FeatureSet to add contextual data from another layer in pop-up not returning results</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/expression-using-featureset-to-add-contextual-data/m-p/1058140#M40067</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/387594"&gt;@FPGIS_FrancescaRohr&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Sorry for the delay, but I was stuck in some meetings. I just had a look at the data and I think I have the answer. As you can see it now returns the&amp;nbsp; number of inspections:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="XanderBakker_0-1621019404268.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/13367iB2A15E4B445A0210/image-size/medium?v=v2&amp;amp;px=400" role="button" title="XanderBakker_0-1621019404268.png" alt="XanderBakker_0-1621019404268.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;There was just a tiny mistake in the expression. when you construct the SQL you use an underscore "_" when the data uses a hyphen "-". Also in my case the name of the layer was a bit different, but this could just be for me.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 19:12:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/expression-using-featureset-to-add-contextual-data/m-p/1058140#M40067</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-05-14T19:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: Expression using FeatureSet to add contextual data from another layer in pop-up not returning results</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/expression-using-featureset-to-add-contextual-data/m-p/1058169#M40068</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp; It's always something small!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&amp;nbsp;Nice job in spotting the teeny mistake which brought down the whole expression. And for pointing me in the right direction. Thank you very much! I can now use this as a base for adding additional, more complex, information from the contextual layer.&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 20:14:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/expression-using-featureset-to-add-contextual-data/m-p/1058169#M40068</guid>
      <dc:creator>FPGIS_FrancescaRohr</dc:creator>
      <dc:date>2021-05-14T20:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: Expression using FeatureSet to add contextual data from another layer in pop-up not returning results</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/expression-using-featureset-to-add-contextual-data/m-p/1058192#M40071</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/387594"&gt;@FPGIS_FrancescaRohr&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I'm glad it was fixed. If you need some more help further along the line, don't hesitate to tag me.&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 21:00:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/expression-using-featureset-to-add-contextual-data/m-p/1058192#M40071</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-05-14T21:00:30Z</dc:date>
    </item>
  </channel>
</rss>

