<?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: definition expression on hosted portal layers? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/definition-expression-on-hosted-portal-layers/m-p/1377660#M83534</link>
    <description>&lt;P&gt;Awesome. Thanks. Looks a lot simpler the way you are doing it. Perfect.&lt;/P&gt;</description>
    <pubDate>Fri, 02 Feb 2024 17:28:14 GMT</pubDate>
    <dc:creator>TimLohnes1</dc:creator>
    <dc:date>2024-02-02T17:28:14Z</dc:date>
    <item>
      <title>definition expression on hosted portal layers?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/definition-expression-on-hosted-portal-layers/m-p/1376241#M83497</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm switching my layers over to hosted feature layers on our portal. I have a javascript map that consumes the data and presents the layer differently based on what user's select.&lt;/P&gt;&lt;P&gt;The way I'm currently doing it is changing the definitionExpression on the layer based on selection.&lt;/P&gt;&lt;P&gt;Now when I'm adding a layer from portalItem&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;streetPavingHostedLayer&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;Layer&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;fromPortalItem&lt;/SPAN&gt;&lt;SPAN&gt;({&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;portalItem&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;// autocasts as new PortalItem()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;id&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"xxxxxxxxxxxxxxxxxx"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;portal&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;url&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"&lt;A href="https://xxxxxxxxxxxx/portal" target="_blank" rel="noopener"&gt;https://xxxxxxxxxxxx/portal&lt;/A&gt;"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;});&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;The above adds the whole layer. But the below doesn't filter correctly. I can't make heads or tails when I inspect the errors. Doesn't point to my code.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Can I add a definition expression, like&amp;nbsp;&amp;nbsp; definitionExpression: "roadname = 'CHABOT CT'"? I can't get it to work. Wondering if it doesn't work or I'm just formatting the expression wrong.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;If I can't do this, wondering if my best bet is to make a different view for each way I want to portray the layer and then just call the layer desired when selected by user?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks for any thoughts.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;-Tim&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2024 00:45:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/definition-expression-on-hosted-portal-layers/m-p/1376241#M83497</guid>
      <dc:creator>TimLohnes1</dc:creator>
      <dc:date>2024-01-31T00:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: definition expression on hosted portal layers?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/definition-expression-on-hosted-portal-layers/m-p/1376466#M83502</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;That definitionExpression looks valid to me. Is it possible for you to shrare your data with me so I can take a look? The following example works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const view = new MapView({
  container: "viewDiv",
  map: map,
  center: [-122.907, 47.018],
  zoom:12
});

const featureLayer = new FeatureLayer({
  url: "https://data.wsdot.wa.gov/arcgis/rest/services/Shared/LocalAgencyPublicRoadData/FeatureServer/0",
  definitionExpression: "RoadName = 'Columbia St NW'"
});&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 31 Jan 2024 15:05:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/definition-expression-on-hosted-portal-layers/m-p/1376466#M83502</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2024-01-31T15:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: definition expression on hosted portal layers?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/definition-expression-on-hosted-portal-layers/m-p/1377385#M83525</link>
      <description>&lt;P&gt;Thanks,&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/53756"&gt;@UndralBatsukh&lt;/a&gt;&amp;nbsp;The code you showed is how I'm using it now. I'm wondering if using layers created from portal have the same capability of using the definitionExpression? See my code above. Thanks.&lt;/P&gt;&lt;P&gt;Here is an example layer,&amp;nbsp;&lt;A href="https://maps.hayward-ca.gov/portal/home/item.html?id=5663a61146c648ca9fd674b58693de47" target="_blank"&gt;https://maps.hayward-ca.gov/portal/home/item.html?id=5663a61146c648ca9fd674b58693de47&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2024 00:53:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/definition-expression-on-hosted-portal-layers/m-p/1377385#M83525</guid>
      <dc:creator>TimLohnes1</dc:creator>
      <dc:date>2024-02-02T00:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: definition expression on hosted portal layers?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/definition-expression-on-hosted-portal-layers/m-p/1377401#M83528</link>
      <description>&lt;P&gt;The definitionExpression does work for your service. Looks like it is a really small road -&amp;nbsp;&lt;A href="https://codepen.io/U_B_U/pen/abMYXbG?editors=1000" target="_blank"&gt;https://codepen.io/U_B_U/pen/abMYXbG?editors=1000&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2024 02:10:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/definition-expression-on-hosted-portal-layers/m-p/1377401#M83528</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2024-02-02T02:10:33Z</dc:date>
    </item>
    <item>
      <title>Re: definition expression on hosted portal layers?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/definition-expression-on-hosted-portal-layers/m-p/1377660#M83534</link>
      <description>&lt;P&gt;Awesome. Thanks. Looks a lot simpler the way you are doing it. Perfect.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2024 17:28:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/definition-expression-on-hosted-portal-layers/m-p/1377660#M83534</guid>
      <dc:creator>TimLohnes1</dc:creator>
      <dc:date>2024-02-02T17:28:14Z</dc:date>
    </item>
  </channel>
</rss>

