<?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 How to clear dynamically created feature layer in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-clear-dynamically-created-feature-layer/m-p/873225#M13064</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P style="margin: 2.0pt 0cm 2.0pt 0cm;"&gt;&lt;SPAN style="font-size: 10.0pt; color: black;"&gt;I am creating dynamic feature class in Widget A and added the layer in the map successfully . When I open Widget B, I want to clear the dynamic feature class which was created in&amp;nbsp; Widget A. How to Proceed?&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 2.0pt 0cm 2.0pt 0cm;"&gt;&lt;/P&gt;&lt;P style="margin: 2.0pt 0cm 2.0pt 0cm;"&gt;&lt;SPAN style="font-size: 10.0pt; color: black;"&gt;Thanks &amp;amp; Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 2.0pt 0cm 2.0pt 0cm;"&gt;&lt;SPAN style="font-size: 10.0pt; color: black;"&gt;Siva&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Apr 2018 11:46:26 GMT</pubDate>
    <dc:creator>SivaramKrishnan2</dc:creator>
    <dc:date>2018-04-24T11:46:26Z</dc:date>
    <item>
      <title>How to clear dynamically created feature layer</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-clear-dynamically-created-feature-layer/m-p/873225#M13064</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P style="margin: 2.0pt 0cm 2.0pt 0cm;"&gt;&lt;SPAN style="font-size: 10.0pt; color: black;"&gt;I am creating dynamic feature class in Widget A and added the layer in the map successfully . When I open Widget B, I want to clear the dynamic feature class which was created in&amp;nbsp; Widget A. How to Proceed?&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 2.0pt 0cm 2.0pt 0cm;"&gt;&lt;/P&gt;&lt;P style="margin: 2.0pt 0cm 2.0pt 0cm;"&gt;&lt;SPAN style="font-size: 10.0pt; color: black;"&gt;Thanks &amp;amp; Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 2.0pt 0cm 2.0pt 0cm;"&gt;&lt;SPAN style="font-size: 10.0pt; color: black;"&gt;Siva&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Apr 2018 11:46:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-clear-dynamically-created-feature-layer/m-p/873225#M13064</guid>
      <dc:creator>SivaramKrishnan2</dc:creator>
      <dc:date>2018-04-24T11:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to clear dynamically created feature layer</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-clear-dynamically-created-feature-layer/m-p/873226#M13065</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sivaram,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;That really depends on how you created the&amp;nbsp;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;dynamic feature class in Widget A. If you added a graphicsLayer or a FeatureLayer, or added Graphics to the maps Graphics. A FeatureLayer has a clear method and so does all GraphicsLayers.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Apr 2018 11:50:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-clear-dynamically-created-feature-layer/m-p/873226#M13065</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2018-04-24T11:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to clear dynamically created feature layer</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-clear-dynamically-created-feature-layer/m-p/873227#M13066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the response, I'm adding the layer as a Feature layer only.&lt;/P&gt;&lt;P&gt;please refer the screenshot.&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/402781_pastedImage_1.png" style="width: 620px; height: 225px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Siva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Apr 2018 12:08:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-clear-dynamically-created-feature-layer/m-p/873227#M13066</guid>
      <dc:creator>SivaramKrishnan2</dc:creator>
      <dc:date>2018-04-24T12:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to clear dynamically created feature layer</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-clear-dynamically-created-feature-layer/m-p/873228#M13067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Siva,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&amp;nbsp; &amp;nbsp;So in your code you should assign a unique id to the FeatureLayer.&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;dynamicFL&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;id &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'myDynamicFL'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;and then in your widget B you get that layer using&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;dynamicFL &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;map&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;getLayer&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;map&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;graphicsLayerIds&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;indexOf&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'myDynamicFL'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;dynamicFL&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;clear&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:55:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-clear-dynamically-created-feature-layer/m-p/873228#M13067</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-12T10:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to clear dynamically created feature layer</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-clear-dynamically-created-feature-layer/m-p/873229#M13068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much for your response, it worked for me after doing some small changes.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="" style="color: #0077aa; border: 0px; font-weight: inherit;"&gt;this&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;dynamicFL &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="" style="color: #0077aa; border: 0px; font-weight: inherit;"&gt;this&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;map&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #d74444; border: 0px; font-weight: inherit;"&gt;getLayer&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #0077aa; border: 0px; font-weight: inherit;"&gt;this&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;map&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;graphicsLayerIds&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #d74444; border: 0px; font-weight: inherit;"&gt;indexOf&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;'myDynamicFL'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;;//this will return the index only not the layer so dynamicFL becomes undefined.

&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;so i modified the code to get the layer of that index&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/402874_pastedImage_1.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;Siva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:55:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-clear-dynamically-created-feature-layer/m-p/873229#M13068</guid>
      <dc:creator>SivaramKrishnan2</dc:creator>
      <dc:date>2021-12-12T10:55:56Z</dc:date>
    </item>
  </channel>
</rss>

