<?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 Dashboard Details - Data Expression to Filter for Attachments in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-details-data-expression-to-filter-for/m-p/1473391#M9596</link>
    <description>&lt;P&gt;Hi! I am trying to create a Dashboard data expression that will let me filter out features without attachments on a feature layer. I'm a noob when it comes to loops and dictionaries. Any suggestions??&amp;nbsp; I was thinking I'd just add a field to the feature set and store the counts and filter off of that. I've got as far as below, but just doesn't seem to work. I think I'm mixing feature sets with arrays and not pushing correctly.&lt;/P&gt;&lt;P&gt;Otherwise Details shows all the features whether they have attachments or not which is awkward.&amp;nbsp;This would be for an ongoing editing project so doing a one time calculation won't be the trick.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Teresa_Blader_0-1715821384764.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/104260iCE970FE91D11FE95/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Teresa_Blader_0-1715821384764.png" alt="Teresa_Blader_0-1715821384764.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var responses = FeatureSetByPortalItem(Portal('https://www.arcgis.com'),'e5f9d47a5ee84f0e97a377912cdae9f6',0,['*'],false)

var responses = {
  'fields': [{
    'attributes': {
      'name': 'counts', 
      'alias': 'Attachment Count', 
      'type': 'esriFieldTypeInteger'
    }
  }]
}

for (var nf in responses){
  var counts = Count(Attachments(nf))}
  responses.counts = {
    'attributes':{
      'counts': nf.counts
    }
}
return responses&lt;/LI-CODE&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, 16 May 2024 01:11:51 GMT</pubDate>
    <dc:creator>Teresa_Blader</dc:creator>
    <dc:date>2024-05-16T01:11:51Z</dc:date>
    <item>
      <title>Dashboard Details - Data Expression to Filter for Attachments</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-details-data-expression-to-filter-for/m-p/1473391#M9596</link>
      <description>&lt;P&gt;Hi! I am trying to create a Dashboard data expression that will let me filter out features without attachments on a feature layer. I'm a noob when it comes to loops and dictionaries. Any suggestions??&amp;nbsp; I was thinking I'd just add a field to the feature set and store the counts and filter off of that. I've got as far as below, but just doesn't seem to work. I think I'm mixing feature sets with arrays and not pushing correctly.&lt;/P&gt;&lt;P&gt;Otherwise Details shows all the features whether they have attachments or not which is awkward.&amp;nbsp;This would be for an ongoing editing project so doing a one time calculation won't be the trick.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Teresa_Blader_0-1715821384764.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/104260iCE970FE91D11FE95/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Teresa_Blader_0-1715821384764.png" alt="Teresa_Blader_0-1715821384764.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var responses = FeatureSetByPortalItem(Portal('https://www.arcgis.com'),'e5f9d47a5ee84f0e97a377912cdae9f6',0,['*'],false)

var responses = {
  'fields': [{
    'attributes': {
      'name': 'counts', 
      'alias': 'Attachment Count', 
      'type': 'esriFieldTypeInteger'
    }
  }]
}

for (var nf in responses){
  var counts = Count(Attachments(nf))}
  responses.counts = {
    'attributes':{
      'counts': nf.counts
    }
}
return responses&lt;/LI-CODE&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, 16 May 2024 01:11:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-details-data-expression-to-filter-for/m-p/1473391#M9596</guid>
      <dc:creator>Teresa_Blader</dc:creator>
      <dc:date>2024-05-16T01:11:51Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard Details - Data Expression to Filter for Attachments</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-details-data-expression-to-filter-for/m-p/1475369#M9608</link>
      <description>&lt;P&gt;I'm trying to do the same thing - to filter features with more than 1 attachment - either in a dashboard or a webmap. I've been trying to use&amp;nbsp;&lt;SPAN&gt;Count&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Attachments&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;$feature&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&amp;nbsp;but the only place I can successfully get it to work at all is within a popup but that is no use when it comes to filtering. Even if I could get the expression in a label it would be useful but it's not working... Any ideas?&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2024 13:34:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-details-data-expression-to-filter-for/m-p/1475369#M9608</guid>
      <dc:creator>DarraghOSullivan</dc:creator>
      <dc:date>2024-05-20T13:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard Details - Data Expression to Filter for Attachments</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-details-data-expression-to-filter-for/m-p/1475521#M9609</link>
      <description>&lt;P&gt;I did get a count to return at least when I wrapped the FeatureSetByPortalItem with the First() function - but that would be on a single feature - a good start though. For dashboard data expression, we want a feature set obviously... so a loop has to be involved and it has to push the features with the attachments. So I think it's possible I just have no experience with loops and how to use the loop to filter a feature set. Hoping someone jumps in and helps!&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var responses = First(FeatureSetByPortalItem(Portal('https://www.arcgis.com'),'e5f9d47a5ee84f0e97a377912cdae9f6',0,['*'],false)))

var counts = Count(Attachments(responses))

return counts&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2024 15:47:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-details-data-expression-to-filter-for/m-p/1475521#M9609</guid>
      <dc:creator>Teresa_Blader</dc:creator>
      <dc:date>2024-05-20T15:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard Details - Data Expression to Filter for Attachments</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-details-data-expression-to-filter-for/m-p/1476035#M9611</link>
      <description>&lt;P&gt;Hi Teresa, I'm new to FeatureSets as well. Maybe in the meantime we can keep trying between us! I notice from the documentation here:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/arcade/guide/featuresets/#:~:text=You%20can%20also%20create%20a,sources%20into%20a%20single%20FeatureSet" target="_blank"&gt;https://developers.arcgis.com/arcade/guide/featuresets/#:~:text=You%20can%20also%20create%20a,sources%20into%20a%20single%20FeatureSet&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;and here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://doc.arcgis.com/en/dashboards/latest/reference/authoring-data-expressions.htm" target="_blank"&gt;https://doc.arcgis.com/en/dashboards/latest/reference/authoring-data-expressions.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;That they usually return a FeatureSet()&amp;nbsp; ... might return&amp;nbsp;FeatureSet(responses) work in your case?&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2024 05:32:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-details-data-expression-to-filter-for/m-p/1476035#M9611</guid>
      <dc:creator>DarraghOSullivan</dc:creator>
      <dc:date>2024-05-21T05:32:43Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard Details - Data Expression to Filter for Attachments</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-details-data-expression-to-filter-for/m-p/1477085#M9626</link>
      <description>&lt;P&gt;Sadly wrapping it in FeatureSet doesn't work because I don't have the loop set up correctly.&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 16:47:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-details-data-expression-to-filter-for/m-p/1477085#M9626</guid>
      <dc:creator>Teresa_Blader</dc:creator>
      <dc:date>2024-05-22T16:47:03Z</dc:date>
    </item>
  </channel>
</rss>

