<?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 Using data expression to filter feature set for display in list in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/using-data-expression-to-filter-feature-set-for/m-p/1505416#M60221</link>
    <description>&lt;P&gt;Hello! I am trying to filter a featureset to only show features that contain carriage returns within a list element.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I have so far, which currently works in test BUT does not allow me to select within data expressions:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var portal = Portal('portal url')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var fs = FeatureSetByPortalItem(portal, "itemid", 0, ['STREETNAME'],false)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var carriageReturnPosition = Find("\r", fs);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if (carriageReturnPosition != -1) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;return Filter(fs, carriageReturnPosition)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;} else {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;return null&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The error that I am getting is 'Unable to execute Arcade Script". What am I doing wrong? Is it possible to accomplish this?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 15 Jul 2024 15:04:15 GMT</pubDate>
    <dc:creator>sophered</dc:creator>
    <dc:date>2024-07-15T15:04:15Z</dc:date>
    <item>
      <title>Using data expression to filter feature set for display in list</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-data-expression-to-filter-feature-set-for/m-p/1505416#M60221</link>
      <description>&lt;P&gt;Hello! I am trying to filter a featureset to only show features that contain carriage returns within a list element.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I have so far, which currently works in test BUT does not allow me to select within data expressions:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var portal = Portal('portal url')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var fs = FeatureSetByPortalItem(portal, "itemid", 0, ['STREETNAME'],false)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var carriageReturnPosition = Find("\r", fs);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if (carriageReturnPosition != -1) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;return Filter(fs, carriageReturnPosition)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;} else {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;return null&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The error that I am getting is 'Unable to execute Arcade Script". What am I doing wrong? Is it possible to accomplish this?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 15:04:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-data-expression-to-filter-feature-set-for/m-p/1505416#M60221</guid>
      <dc:creator>sophered</dc:creator>
      <dc:date>2024-07-15T15:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using data expression to filter feature set for display in list</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-data-expression-to-filter-feature-set-for/m-p/1505417#M60222</link>
      <description>&lt;LI-CODE lang="c"&gt;var portal = Portal('portal url')
var fs = FeatureSetByPortalItem(portal, "itemid", 0, ['STREETNAME'],false)
var carriageReturnPosition = Find("\r", fs);
if (carriageReturnPosition != -1) {
return Filter(fs, carriageReturnPosition)
} else {
return null
}&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 15 Jul 2024 15:04:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-data-expression-to-filter-feature-set-for/m-p/1505417#M60222</guid>
      <dc:creator>sophered</dc:creator>
      <dc:date>2024-07-15T15:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: Using data expression to filter feature set for display in list</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-data-expression-to-filter-feature-set-for/m-p/1505427#M60225</link>
      <description>&lt;P&gt;For a Data Expression, you need to return a FeatureSet, no matter what. It's fine to return the result of the Filter function, even if there are no matching features. Also, the &lt;STRONG&gt;Filter&lt;/STRONG&gt; expression takes a &lt;EM&gt;SQL statement&lt;/EM&gt;, not an Arcade variable. Try something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var portal = Portal('portal url')
var fs = FeatureSetByPortalItem(portal, "itemid", 0, ['STREETNAME'],false)

return Filter(fs, "STREETNAME LIKE '%\r%'")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That should filter to the features where the field has a return somewhere in them. Not sure how your database will like that, though. You may need to use a function to specify the carriage return character.&lt;/P&gt;&lt;PRE&gt;'%'+char(13)+'%' or name like '%'+char(10)+'%'&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 15:24:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-data-expression-to-filter-feature-set-for/m-p/1505427#M60225</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-07-15T15:24:19Z</dc:date>
    </item>
  </channel>
</rss>

