<?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: Apply definitionExpression to operationalLayer? in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/apply-definitionexpression-to-operationallayer/m-p/1028504#M14404</link>
    <description>&lt;P&gt;James,&lt;/P&gt;&lt;P&gt;&amp;nbsp; You absolutely wouldn't in your situation. You have already looping through your layer in the webmap and getting the layer you want so you then just set the layer definitionExpression using the method provided on the layerObject. Originally in your code you were attempting to set it using the property "definitionExpression". That will not work you have to set it using the method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;lyr.setDefinitionExpression("alertPriority = 'Low'");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 19 Feb 2021 14:52:59 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2021-02-19T14:52:59Z</dc:date>
    <item>
      <title>Apply definitionExpression to operationalLayer?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/apply-definitionexpression-to-operationallayer/m-p/1028464#M14399</link>
      <description>&lt;P&gt;Within a custom widget I'm developing I am accessing specific layers that are loaded into an existing webmap by way of:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;_operLayers = this.map.itemInfo.itemData.operationalLayers;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can then do some things like toggle visibility by setting a reference to a layerObject like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;array.map(_operLayers, lang.hitch(this, function (lyr) {
                    if (lyr.layerObject) {
                        if (lyr.title === "Alert 7day - Hydraulic Element Set") {
                            lyr.layerObject.setVisibility(true);
                            lyr.visibility = true;
                            lyr.definitionExpression = "alertPriority = 'Low'";
                        }
                    }
                }
                ))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way to set a filter/definitionExpression on this layerObject?&amp;nbsp; As you can see above, what I attempted has no effect.&lt;/P&gt;&lt;P&gt;Of note: the service layers contained in the webmap are enriched with additional attributes from a Server Object Interceptor and consequently I'm unable to apply the desired definitionExpression/filter on the AGO item created from that service layer.&amp;nbsp; We need a way to set a date value &amp;gt; CURRENT_TIMESTAMP but the service does not honor this type of WHERE clause.&lt;/P&gt;&lt;P&gt;Thanks for any input.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 13:54:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/apply-definitionexpression-to-operationallayer/m-p/1028464#M14399</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-02-19T13:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: Apply definitionExpression to operationalLayer?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/apply-definitionexpression-to-operationallayer/m-p/1028477#M14400</link>
      <description>&lt;P&gt;James,&lt;/P&gt;&lt;P&gt;&amp;nbsp; What is the layer type (i.e. FeatureLayer or ArcGisDynamicMapServiceLayer)? If it is a Feature layer than you set the definition using the method setDefinitionExpression&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/3/jsapi/featurelayer-amd.html#setdefinitionexpression" target="_blank"&gt;https://developers.arcgis.com/javascript/3/jsapi/featurelayer-amd.html#setdefinitionexpression&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 14:06:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/apply-definitionexpression-to-operationallayer/m-p/1028477#M14400</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-02-19T14:06:17Z</dc:date>
    </item>
    <item>
      <title>Re: Apply definitionExpression to operationalLayer?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/apply-definitionexpression-to-operationallayer/m-p/1028479#M14401</link>
      <description>&lt;P&gt;Robert -- we add the specific service layer to the webmap using the "Add data from web" option, then when it's added we save it (after setting up popups, symbology, etc).&amp;nbsp; So, I believe it's a "FeatureLayer" at that point?&lt;/P&gt;&lt;P&gt;Inspecting the lyr in dev tools says layerType: "ArcGISFeatureLayer"&lt;/P&gt;&lt;P&gt;Edit: also, all of the examples show for a "new FeatureLayer()" but I'm misunderstanding how this applies to the FeatureLayers already in the map?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 14:19:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/apply-definitionexpression-to-operationallayer/m-p/1028479#M14401</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-02-19T14:19:14Z</dc:date>
    </item>
    <item>
      <title>Re: Apply definitionExpression to operationalLayer?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/apply-definitionexpression-to-operationallayer/m-p/1028497#M14402</link>
      <description>&lt;P&gt;James,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;It will be a FeatureLayer if the url you provided ends with the sublayer id (i.e FeatureServer/1 or MapServer/0).&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 14:36:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/apply-definitionexpression-to-operationallayer/m-p/1028497#M14402</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-02-19T14:36:05Z</dc:date>
    </item>
    <item>
      <title>Re: Apply definitionExpression to operationalLayer?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/apply-definitionexpression-to-operationallayer/m-p/1028498#M14403</link>
      <description>&lt;P&gt;Yes that's how it is added with the layer id at the end.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm still not quite following the examples as they are all suggesting to create a reference to a "new FeatureLayer()", set the definitionExpress and then add it to the map.&amp;nbsp; But my confusion is, it's already added to the map, I'm not seeing why I would create a new instance and add it again?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 14:42:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/apply-definitionexpression-to-operationallayer/m-p/1028498#M14403</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-02-19T14:42:32Z</dc:date>
    </item>
    <item>
      <title>Re: Apply definitionExpression to operationalLayer?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/apply-definitionexpression-to-operationallayer/m-p/1028504#M14404</link>
      <description>&lt;P&gt;James,&lt;/P&gt;&lt;P&gt;&amp;nbsp; You absolutely wouldn't in your situation. You have already looping through your layer in the webmap and getting the layer you want so you then just set the layer definitionExpression using the method provided on the layerObject. Originally in your code you were attempting to set it using the property "definitionExpression". That will not work you have to set it using the method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;lyr.setDefinitionExpression("alertPriority = 'Low'");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 14:52:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/apply-definitionexpression-to-operationallayer/m-p/1028504#M14404</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-02-19T14:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: Apply definitionExpression to operationalLayer?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/apply-definitionexpression-to-operationallayer/m-p/1028557#M14405</link>
      <description>&lt;P&gt;Thanks Robert, that makes sense.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 15:53:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/apply-definitionexpression-to-operationallayer/m-p/1028557#M14405</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-02-19T15:53:35Z</dc:date>
    </item>
  </channel>
</rss>

