<?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: Popup Content with Layer ID in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popup-content-with-layer-id/m-p/1212663#M78716</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/496812"&gt;@MichaelK1&lt;/a&gt;&amp;nbsp;-&lt;/P&gt;&lt;P&gt;You could access the layer ID of the current selected feature by creating your content from a function like this:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;layer.popupTemplate = {
    title: "{ObjectId} | {length}",
    expressionInfos: [{
        name: "length",
        expression: "$feature.length"
    }],
    // Create content from function and refernece the feature's layer id
    content: ((event) =&amp;gt; {
        return `{length} | ${event.graphic.layer.id}`;
    })
};&lt;/LI-CODE&gt;&lt;P&gt;You can still reference expressions within the function as well. Here's an updated codepen:&amp;nbsp;&lt;A href="https://codepen.io/laurenb14/pen/gOzLExz?editors=1000" target="_blank"&gt;https://codepen.io/laurenb14/pen/gOzLExz?editors=1000&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
    <pubDate>Wed, 14 Sep 2022 20:30:13 GMT</pubDate>
    <dc:creator>LaurenBoyd</dc:creator>
    <dc:date>2022-09-14T20:30:13Z</dc:date>
    <item>
      <title>Popup Content with Layer ID</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popup-content-with-layer-id/m-p/1212406#M78708</link>
      <description>&lt;P&gt;Is it possible to show layer id in a popup's template ?&lt;/P&gt;&lt;P&gt;layer expression:&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;name: "layer",&lt;BR /&gt;title: "layer",&lt;BR /&gt;expression: "$layer.id"&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://codepen.io/michaelk95/pen/NWwyxyE" target="_blank"&gt;https://codepen.io/michaelk95/pen/NWwyxyE&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2022 12:55:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popup-content-with-layer-id/m-p/1212406#M78708</guid>
      <dc:creator>MichaelK1</dc:creator>
      <dc:date>2022-09-14T12:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: Popup Content with Layer ID</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popup-content-with-layer-id/m-p/1212437#M78710</link>
      <description>&lt;P&gt;The global name "$layer" is misleading. It actually represents the FeatureSet of all features in the same layer as the Popup's feature:&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/arcade/guide/types/#featureset" target="_blank" rel="noopener"&gt;ArcGIS Arcade &amp;gt; FeatureSet&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I suggest adding a feature attribute for the id/title.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2022 14:05:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popup-content-with-layer-id/m-p/1212437#M78710</guid>
      <dc:creator>DougLogsdon2</dc:creator>
      <dc:date>2022-09-14T14:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: Popup Content with Layer ID</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popup-content-with-layer-id/m-p/1212663#M78716</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/496812"&gt;@MichaelK1&lt;/a&gt;&amp;nbsp;-&lt;/P&gt;&lt;P&gt;You could access the layer ID of the current selected feature by creating your content from a function like this:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;layer.popupTemplate = {
    title: "{ObjectId} | {length}",
    expressionInfos: [{
        name: "length",
        expression: "$feature.length"
    }],
    // Create content from function and refernece the feature's layer id
    content: ((event) =&amp;gt; {
        return `{length} | ${event.graphic.layer.id}`;
    })
};&lt;/LI-CODE&gt;&lt;P&gt;You can still reference expressions within the function as well. Here's an updated codepen:&amp;nbsp;&lt;A href="https://codepen.io/laurenb14/pen/gOzLExz?editors=1000" target="_blank"&gt;https://codepen.io/laurenb14/pen/gOzLExz?editors=1000&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2022 20:30:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popup-content-with-layer-id/m-p/1212663#M78716</guid>
      <dc:creator>LaurenBoyd</dc:creator>
      <dc:date>2022-09-14T20:30:13Z</dc:date>
    </item>
  </channel>
</rss>

