<?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: If statement for multiple feature layers infotemplate in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/if-statement-for-multiple-feature-layers/m-p/297144#M27319</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm not exactly 100% on the workflow that get's you to &lt;/SPAN&gt;&lt;STRONG&gt;getTextContent(graphic)&lt;/STRONG&gt;&lt;SPAN&gt; or how undefined would be returned if you return something else when SHELTER is undefined.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Aug 2013 19:57:24 GMT</pubDate>
    <dc:creator>BenFousek</dc:creator>
    <dc:date>2013-08-28T19:57:24Z</dc:date>
    <item>
      <title>If statement for multiple feature layers infotemplate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/if-statement-for-multiple-feature-layers/m-p/297141#M27316</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have added two FeatureLayers to query attributes from in an infotemplate (popup). What I would like to figure out is how to write an if statement that states if one attribute is undefined ("SHELTER") to use another attribute field ("BUILDING"), and add to the following function. Is this possible?&lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;function getTextContent(graphic) { //continuation of popup feature &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var bldg = "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Shelter: " +graphic.attributes.SHELTER + "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Shelter Room: " +graphic.attributes.LOCATION; //fields, within the featureLayer, to return information for &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&amp;nbsp; bldg; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/PRE&gt;&lt;SPAN&gt;Or, another idea, is how to simply have it always query the top-most layer attributes? I think that would solve my problem as well.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 17:42:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/if-statement-for-multiple-feature-layers/m-p/297141#M27316</guid>
      <dc:creator>BarryGuidry</dc:creator>
      <dc:date>2013-08-28T17:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for multiple feature layers infotemplate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/if-statement-for-multiple-feature-layers/m-p/297142#M27317</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function getTextContent(graphic) {
&amp;nbsp; if (graphic.attributes.SHELTER === undefined) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; //do stuff 
&amp;nbsp; } else {
&amp;nbsp;&amp;nbsp;&amp;nbsp; //do stuff 
&amp;nbsp; }
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:16:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/if-statement-for-multiple-feature-layers/m-p/297142#M27317</guid>
      <dc:creator>BenFousek</dc:creator>
      <dc:date>2021-12-11T14:16:02Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for multiple feature layers infotemplate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/if-statement-for-multiple-feature-layers/m-p/297143#M27318</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you, Ben. That works except, as I expected, may display the "undefined" information first in a series of features to navigate in the popup. I would rather it display the attributes of the top-most layer of the feature selected instead. Any ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 19:41:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/if-statement-for-multiple-feature-layers/m-p/297143#M27318</guid>
      <dc:creator>BarryGuidry</dc:creator>
      <dc:date>2013-08-28T19:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for multiple feature layers infotemplate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/if-statement-for-multiple-feature-layers/m-p/297144#M27319</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm not exactly 100% on the workflow that get's you to &lt;/SPAN&gt;&lt;STRONG&gt;getTextContent(graphic)&lt;/STRONG&gt;&lt;SPAN&gt; or how undefined would be returned if you return something else when SHELTER is undefined.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 19:57:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/if-statement-for-multiple-feature-layers/m-p/297144#M27319</guid>
      <dc:creator>BenFousek</dc:creator>
      <dc:date>2013-08-28T19:57:24Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for multiple feature layers infotemplate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/if-statement-for-multiple-feature-layers/m-p/297145#M27320</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Almost where I need to be with this:&lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function getTextContent(graphic) { //continuation of popup feature
&amp;nbsp;&amp;nbsp; if (graphic.attributes.SHELTER === undefined) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var bldg = "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;BUILDING: " +graphic.attributes.BUILDING; //fields, within the featureLayer, to return information for
&amp;nbsp;&amp;nbsp; return bldg;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {
&amp;nbsp;&amp;nbsp; var bldg2 = "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;BUILDING: " +graphic.attributes.SHELTER + "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Shelter Room: " +graphic.attributes.LOCATION;
&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; return&amp;nbsp; bldg2;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;SPAN&gt;But, would also rather force the popup to auto navigate to the second record of the selected feature if SHELTER is undefined, in addition to displaying the attributes of the variable "bldg2" above. Is there a code snippet to navigate to the next record in an infotemplate popup?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:16:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/if-statement-for-multiple-feature-layers/m-p/297145#M27320</guid>
      <dc:creator>BarryGuidry</dc:creator>
      <dc:date>2021-12-11T14:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for multiple feature layers infotemplate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/if-statement-for-multiple-feature-layers/m-p/297146#M27321</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;FeatureLayer variable name&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As in the layer itself or any of the layer's properties, functions, etc?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;//the layer itself var layer = graphic.getLayer();&amp;nbsp; //the layer's id var layerId = graphic.getLayer().id;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;function getTextContent(graphic) { &amp;nbsp; if (graphic.getLayer().id === 'feature_layer_one') { &amp;nbsp;&amp;nbsp;&amp;nbsp; //do stuff&amp;nbsp; &amp;nbsp; } else if (graphic.getLayer().id === 'feature_layer_two') { &amp;nbsp;&amp;nbsp;&amp;nbsp; //do stuff&amp;nbsp; &amp;nbsp; } }&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You would need to set the feature layer's id on creation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;var fl = new esri.layers.FeatureLayer(url, { &amp;nbsp; mode: 1, &amp;nbsp; id: 'feature_layer_one' });&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 20:48:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/if-statement-for-multiple-feature-layers/m-p/297146#M27321</guid>
      <dc:creator>BenFousek</dc:creator>
      <dc:date>2013-08-28T20:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for multiple feature layers infotemplate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/if-statement-for-multiple-feature-layers/m-p/297147#M27322</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;As in the layer itself or any of the layer's properties, functions, etc?&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;//the layer itself
var layer = graphic.getLayer();

//the layer's id
var layerId = graphic.getLayer().id;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function getTextContent(graphic) {
&amp;nbsp; if (graphic.getLayer().id === 'feature_layer_one') {
&amp;nbsp;&amp;nbsp;&amp;nbsp; //do stuff 
&amp;nbsp; } else if (graphic.getLayer().id === 'feature_layer_two') {
&amp;nbsp;&amp;nbsp;&amp;nbsp; //do stuff 
&amp;nbsp; }
}&lt;/PRE&gt;You would need to set the feature layer's id on creation.&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var fl = new esri.layers.FeatureLayer(url, {
&amp;nbsp; mode: 1,
&amp;nbsp; &lt;STRONG&gt;id: 'feature_layer_one'&lt;/STRONG&gt;
});&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt;Thats even better, Ben, but I still need to somehow have it navigate to attributes of 'feature_layer_one' first if it exists where clicked, and if non-existent, then navigate to 'feature_layer_two', as well, somewhere in the if statement that I have now (below).&lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function getTextContent(graphic) { //continuation of popup feature
&amp;nbsp;&amp;nbsp; if (graphic.getLayer().id === 'fl') {
&amp;nbsp;&amp;nbsp; var bldg = "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;BUILDING: " +graphic.attributes.SHELTER + "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Shelter Room: " +graphic.attributes.LOCATION; //fields, within the featureLayer, to return information for
&amp;nbsp;&amp;nbsp; return&amp;nbsp; bldg; 
&amp;nbsp;&amp;nbsp; } else if (graphic.getLayer().id === 'fl2') {
&amp;nbsp;&amp;nbsp; var bldg = "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;BUILDING: " +graphic.attributes.BUILDING; //fields, within the featureLayer, to return information for
&amp;nbsp;&amp;nbsp; return bldg; 
&amp;nbsp;&amp;nbsp; }
&amp;nbsp; }&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:16:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/if-statement-for-multiple-feature-layers/m-p/297147#M27322</guid>
      <dc:creator>BarryGuidry</dc:creator>
      <dc:date>2021-12-11T14:16:07Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for multiple feature layers infotemplate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/if-statement-for-multiple-feature-layers/m-p/297148#M27323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there a reason you don't just set the infoTemplate of the feature layer?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Aug 2013 13:58:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/if-statement-for-multiple-feature-layers/m-p/297148#M27323</guid>
      <dc:creator>BenFousek</dc:creator>
      <dc:date>2013-08-29T13:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for multiple feature layers infotemplate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/if-statement-for-multiple-feature-layers/m-p/297149#M27324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Is there a reason you don't just set the infoTemplate of the feature layer?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes Sir. I am pulling attribute data from two FeatureLayers, with one of the fields being the same name (for good reason; BUILDING).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Aug 2013 15:32:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/if-statement-for-multiple-feature-layers/m-p/297149#M27324</guid>
      <dc:creator>BarryGuidry</dc:creator>
      <dc:date>2013-08-29T15:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for multiple feature layers infotemplate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/if-statement-for-multiple-feature-layers/m-p/297150#M27325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; Is there a code snippet to navigate to the next record in an infotemplate popup?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can use select function of infoWindow to navigate to the index of feature&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/en/javascript/jsapi/popup-amd.html#select"&gt;https://developers.arcgis.com/en/javascript/jsapi/popup-amd.html#select&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Aug 2013 11:26:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/if-statement-for-multiple-feature-layers/m-p/297150#M27325</guid>
      <dc:creator>VinayBansal</dc:creator>
      <dc:date>2013-08-30T11:26:08Z</dc:date>
    </item>
  </channel>
</rss>

