<?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: Message Alert! in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/message-alert/m-p/841710#M9413</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank You Robert,&lt;/P&gt;&lt;P&gt;Programming is Fun! Finally after little struggle, I got the message alert on my app here is the working code: This is my first little effort. Suggest me is it ok.&lt;/P&gt;&lt;P&gt;on.once(this.map, 'update-end', lang.hitch(this, function () {&lt;BR /&gt; var aa = this.layerInfosObj.getLayerInfoById('MyLayer_1);&lt;BR /&gt; var bb = this.layerInfosObj.getLayerInfoById('MyLayer_2');&lt;BR /&gt; if (aa.layerObject.graphics.length=== 0 || bb.layerObject.graphics.length=== 0){&lt;BR /&gt; this._showMessage("No features found");&lt;BR /&gt; } &lt;BR /&gt; // else {(aa.layerObject.graphics.length!= 0 || bb.layerObject.graphics.length!= 0)&lt;BR /&gt; else {&lt;BR /&gt; var a1 = aa.layerObject.graphics.length;&lt;BR /&gt; var b1 = bb.layerObject.graphics.length;&lt;BR /&gt; this._showMessage( a1+ b1+ " Feature(s) found");&lt;BR /&gt; }&lt;BR /&gt; }));&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Feb 2018 20:23:03 GMT</pubDate>
    <dc:creator>James_001</dc:creator>
    <dc:date>2018-02-28T20:23:03Z</dc:date>
    <item>
      <title>Message Alert!</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/message-alert/m-p/841706#M9409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi fellows,&lt;/P&gt;&lt;P&gt;I was trying to add message alert in one of my custom widget to get the features count for two features layers together but somehow it only does for one layer. What is the best way to fix this? I will appreciate any help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the block of code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;on.once(this.map, 'update-end', lang.hitch(this, function () {&lt;BR /&gt; &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;var aa = this.layerInfosObj.getLayerInfoById('Mylayer_1 || Mylayer_2');&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt; if (aa.layerObject.graphics.length === 0) {&lt;BR /&gt; this._showMessage("No features found");&lt;BR /&gt; }&lt;BR /&gt; else {&lt;BR /&gt; var a1 = aa.layerObject.graphics.length;&lt;BR /&gt; this._showMessage(a1 + " Feature(s) found");&lt;BR /&gt; }&lt;BR /&gt; }));&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Feb 2018 22:07:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/message-alert/m-p/841706#M9409</guid>
      <dc:creator>James_001</dc:creator>
      <dc:date>2018-02-23T22:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: Message Alert!</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/message-alert/m-p/841707#M9410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Irfan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; You can not use a line like this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; aa &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;layerInfosObj&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;getLayerInfoById&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Mylayer_1 || Mylayer_2'&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The getLayerInfoById is expecting one layer id and that is all.&lt;/P&gt;&lt;P&gt;Maybe something like:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; aa &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;layerInfosObj&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;getLayerInfoById&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Mylayer_1'&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;var&lt;/SPAN&gt; bb &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;layerInfosObj&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;getLayerInfoById&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Mylayer_2'&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="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;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;is what you are looking for.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:16:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/message-alert/m-p/841707#M9410</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-12T10:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: Message Alert!</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/message-alert/m-p/841708#M9411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert,&lt;/P&gt;&lt;P&gt;Thank you once more for your help!&lt;/P&gt;&lt;P&gt;I was trying the above code with your suggestions. Not an idea how to incorporate in this block of code to get the message alert for both layers. Can you please help me . I am new to programming and trying to learn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also have tried this too:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;on.once(this.map, 'update-end', lang.hitch(this, function () {&lt;BR /&gt;var aa = this.layerInfosObj.getLayerInfoById('Mylayer_1');&lt;BR /&gt;var bb = this.layerInfosObj.getLayerInfoById('Mylayer_2');&lt;BR /&gt;if (aa.layerObject.graphics.length=== 0) || bb.layerObject.graphics.length=== 0){&lt;BR /&gt;this._showMessage("No features found");&lt;BR /&gt;}&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;else {&lt;/P&gt;&lt;P&gt;var a1 = aa.layerObject.graphics.length ||var a2 = bb.layerObject.graphics.length;&lt;BR /&gt;this._showMessage(a1+a2+ " Feature(s) found");&lt;BR /&gt;}&lt;BR /&gt;}));&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Feb 2018 17:14:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/message-alert/m-p/841708#M9411</guid>
      <dc:creator>James_001</dc:creator>
      <dc:date>2018-02-26T17:14:13Z</dc:date>
    </item>
    <item>
      <title>Re: Message Alert!</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/message-alert/m-p/841709#M9412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Irfan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;You do not use an || (or) in a variable declaration unless you do something like this.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; a1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; aa&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layerObject&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;graphics&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;length &lt;SPAN class="operator token"&gt;||&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; a2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; bb&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layerObject&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;graphics&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;length &lt;SPAN class="operator token"&gt;||&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&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:17:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/message-alert/m-p/841709#M9412</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-12T10:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: Message Alert!</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/message-alert/m-p/841710#M9413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank You Robert,&lt;/P&gt;&lt;P&gt;Programming is Fun! Finally after little struggle, I got the message alert on my app here is the working code: This is my first little effort. Suggest me is it ok.&lt;/P&gt;&lt;P&gt;on.once(this.map, 'update-end', lang.hitch(this, function () {&lt;BR /&gt; var aa = this.layerInfosObj.getLayerInfoById('MyLayer_1);&lt;BR /&gt; var bb = this.layerInfosObj.getLayerInfoById('MyLayer_2');&lt;BR /&gt; if (aa.layerObject.graphics.length=== 0 || bb.layerObject.graphics.length=== 0){&lt;BR /&gt; this._showMessage("No features found");&lt;BR /&gt; } &lt;BR /&gt; // else {(aa.layerObject.graphics.length!= 0 || bb.layerObject.graphics.length!= 0)&lt;BR /&gt; else {&lt;BR /&gt; var a1 = aa.layerObject.graphics.length;&lt;BR /&gt; var b1 = bb.layerObject.graphics.length;&lt;BR /&gt; this._showMessage( a1+ b1+ " Feature(s) found");&lt;BR /&gt; }&lt;BR /&gt; }));&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Feb 2018 20:23:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/message-alert/m-p/841710#M9413</guid>
      <dc:creator>James_001</dc:creator>
      <dc:date>2018-02-28T20:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: Message Alert!</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/message-alert/m-p/841711#M9414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Irfan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;That is OK but it would be better if you use the bit I provided in my last reply.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Feb 2018 20:25:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/message-alert/m-p/841711#M9414</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2018-02-28T20:25:27Z</dc:date>
    </item>
    <item>
      <title>Re: Message Alert!</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/message-alert/m-p/841712#M9415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since the if statement uses the "Logical or" (||) operator, you'll get the message "No features found" when one of the layers has graphics but the other doesn't. Is that what you're expecting?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Feb 2018 20:35:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/message-alert/m-p/841712#M9415</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2018-02-28T20:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: Message Alert!</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/message-alert/m-p/841713#M9416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert,&lt;/P&gt;&lt;P&gt;Thanks. Something like this. It is also working.&lt;/P&gt;&lt;P&gt;on.once(this.map, 'update-end', lang.hitch(this, function () {&lt;BR /&gt; var aa = this.layerInfosObj.getLayerInfoById('&lt;SPAN style="background-color: #ffffff;"&gt;MyLayer_1&lt;/SPAN&gt;');&lt;BR /&gt; var bb = this.layerInfosObj.getLayerInfoById('&lt;SPAN style="background-color: #ffffff;"&gt;MyLayer_1&lt;/SPAN&gt;);&lt;BR /&gt; if (aa.layerObject.graphics.length=== 0 || bb.layerObject.graphics.length=== 0){&lt;BR /&gt; this._showMessage("No features found");&lt;BR /&gt; } &lt;BR /&gt; // else {(aa.layerObject.graphics.length!= 0 || bb.layerObject.graphics.length!= 0)&lt;BR /&gt; else {&lt;BR /&gt; var a1 = aa.layerObject.graphics.length || 0;&lt;BR /&gt; var b1 = bb.layerObject.graphics.length || 0;&lt;BR /&gt; this._showMessage( a1+ b1+ " Feature(s) found");&lt;BR /&gt; }&lt;BR /&gt; }));&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Feb 2018 21:04:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/message-alert/m-p/841713#M9416</guid>
      <dc:creator>James_001</dc:creator>
      <dc:date>2018-02-28T21:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: Message Alert!</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/message-alert/m-p/841714#M9417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ken,&lt;/P&gt;&lt;P&gt;Actually, I was trying to get message alert (no of features) on submit event button. By default, I am accessing both&amp;nbsp; layers together(same attribute).&amp;nbsp;That's right if any layer have number of graphic it should show in message alert or on the other hand it show 'No features found" both layer must be true.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Feb 2018 21:14:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/message-alert/m-p/841714#M9417</guid>
      <dc:creator>James_001</dc:creator>
      <dc:date>2018-02-28T21:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: Message Alert!</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/message-alert/m-p/841715#M9418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In that case, you should use the &amp;amp;&amp;amp; operator instead.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Mar 2018 14:46:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/message-alert/m-p/841715#M9418</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2018-03-01T14:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: Message Alert!</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/message-alert/m-p/841716#M9419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Ken,&lt;/P&gt;&lt;P&gt;You are right!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Mar 2018 19:39:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/message-alert/m-p/841716#M9419</guid>
      <dc:creator>James_001</dc:creator>
      <dc:date>2018-03-01T19:39:48Z</dc:date>
    </item>
  </channel>
</rss>

