<?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 Use a range for selector in Dashboard in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/use-a-range-for-selector-in-dashboard/m-p/1602957#M10993</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I am trying to filter data in a dashboard by ranges in the layer.&amp;nbsp; &amp;nbsp; I can calculate a new field, but would rather not have to do this as new data will be added soon&lt;/P&gt;&lt;P&gt;I have some building data and need to group the records by ranges of leased percentages&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;0-5%&lt;/LI&gt;&lt;LI&gt;5-10%&lt;/LI&gt;&lt;LI&gt;10-15&lt;/LI&gt;&lt;LI&gt;15-20%&lt;/LI&gt;&lt;LI&gt;20-25%&lt;/LI&gt;&lt;LI&gt;25-30%&lt;/LI&gt;&lt;LI&gt;30-50%&lt;/LI&gt;&lt;LI&gt;50-100%&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I have created a feature set that assigns the ranges, but I can't figure out how to configure a selector to filter the layer on the dashboard map&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;LI-CODE lang="c"&gt;var fs = FeatureSetByPortalItem(
  Portal(''),
  // portal item id
  "",
  0, // layer id
  ["Record_ID", "Percent_Leased" ], // fields to include
  true // include or exclude geometry
);

// convert field list to series of SQL expressions for Distinct function
var fields = Schema(fs)['fields']
var sqlfields = []

for (var f in fields) {
  Push(
    sqlfields,
    {name: fields[f]['name'], expression: fields[f]['name']}
  )
}

var leasecat_sql = `CASE
WHEN Percent_Leased &amp;gt;= 0 and Percent_Leased &amp;lt; 5 THEN '0-5'
WHEN Percent_Leased &amp;gt; 5 and Percent_Leased &amp;lt;= 10 THEN '5-10'
WHEN Percent_Leased &amp;gt; 10 and Percent_Leased &amp;lt;= 15 THEN '10-15'
WHEN Percent_Leased &amp;gt; 15 and Percent_Leased &amp;lt;= 20 THEN '15-20'
WHEN Percent_Leased &amp;gt; 20 and Percent_Leased &amp;lt;= 25 THEN '20-25'
WHEN Percent_Leased &amp;gt; 25 and Percent_Leased &amp;lt;= 30 THEN '25-30'
WHEN Percent_Leased &amp;gt; 30 and Percent_Leased &amp;lt;= 50 THEN '30-50'
WHEN Percent_Leased &amp;gt; 50 THEN '50-100'
ELSE 'UNK'
END`

return Distinct(
  fs,
  Splice(
    sqlfields,
    {name: 'Lease_category', expression: leasecat_sql}  )
)&lt;/LI-CODE&gt;&lt;P&gt;Any thoughts on how to use the Lease_Category in the Featureset as an action to filter the layer by Percent_Leased?&amp;nbsp; &amp;nbsp; Thank you&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 04 Apr 2025 19:43:31 GMT</pubDate>
    <dc:creator>MeleKoneya1</dc:creator>
    <dc:date>2025-04-04T19:43:31Z</dc:date>
    <item>
      <title>Use a range for selector in Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/use-a-range-for-selector-in-dashboard/m-p/1602957#M10993</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I am trying to filter data in a dashboard by ranges in the layer.&amp;nbsp; &amp;nbsp; I can calculate a new field, but would rather not have to do this as new data will be added soon&lt;/P&gt;&lt;P&gt;I have some building data and need to group the records by ranges of leased percentages&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;0-5%&lt;/LI&gt;&lt;LI&gt;5-10%&lt;/LI&gt;&lt;LI&gt;10-15&lt;/LI&gt;&lt;LI&gt;15-20%&lt;/LI&gt;&lt;LI&gt;20-25%&lt;/LI&gt;&lt;LI&gt;25-30%&lt;/LI&gt;&lt;LI&gt;30-50%&lt;/LI&gt;&lt;LI&gt;50-100%&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I have created a feature set that assigns the ranges, but I can't figure out how to configure a selector to filter the layer on the dashboard map&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;LI-CODE lang="c"&gt;var fs = FeatureSetByPortalItem(
  Portal(''),
  // portal item id
  "",
  0, // layer id
  ["Record_ID", "Percent_Leased" ], // fields to include
  true // include or exclude geometry
);

// convert field list to series of SQL expressions for Distinct function
var fields = Schema(fs)['fields']
var sqlfields = []

for (var f in fields) {
  Push(
    sqlfields,
    {name: fields[f]['name'], expression: fields[f]['name']}
  )
}

var leasecat_sql = `CASE
WHEN Percent_Leased &amp;gt;= 0 and Percent_Leased &amp;lt; 5 THEN '0-5'
WHEN Percent_Leased &amp;gt; 5 and Percent_Leased &amp;lt;= 10 THEN '5-10'
WHEN Percent_Leased &amp;gt; 10 and Percent_Leased &amp;lt;= 15 THEN '10-15'
WHEN Percent_Leased &amp;gt; 15 and Percent_Leased &amp;lt;= 20 THEN '15-20'
WHEN Percent_Leased &amp;gt; 20 and Percent_Leased &amp;lt;= 25 THEN '20-25'
WHEN Percent_Leased &amp;gt; 25 and Percent_Leased &amp;lt;= 30 THEN '25-30'
WHEN Percent_Leased &amp;gt; 30 and Percent_Leased &amp;lt;= 50 THEN '30-50'
WHEN Percent_Leased &amp;gt; 50 THEN '50-100'
ELSE 'UNK'
END`

return Distinct(
  fs,
  Splice(
    sqlfields,
    {name: 'Lease_category', expression: leasecat_sql}  )
)&lt;/LI-CODE&gt;&lt;P&gt;Any thoughts on how to use the Lease_Category in the Featureset as an action to filter the layer by Percent_Leased?&amp;nbsp; &amp;nbsp; Thank you&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Apr 2025 19:43:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/use-a-range-for-selector-in-dashboard/m-p/1602957#M10993</guid>
      <dc:creator>MeleKoneya1</dc:creator>
      <dc:date>2025-04-04T19:43:31Z</dc:date>
    </item>
  </channel>
</rss>

