<?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: Arcade expression fails at $layer profile in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-fails-at-layer-profile/m-p/1496047#M59825</link>
    <description>&lt;P&gt;Playground doesn't use a &lt;A href="https://developers.arcgis.com/arcade/profiles/" target="_self"&gt;profile&lt;/A&gt; where you can use $layer. If you click on "Profile variables", it only shows "$feature".&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Snag_af67ee.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/107659iBCEE11347E860C47/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Snag_af67ee.png" alt="Snag_af67ee.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You'll have to test out your code in a web map where you have access to more profile variables.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Snag_b1067b.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/107663iB190DFB9A8FF1D83/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Snag_b1067b.png" alt="Snag_b1067b.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 21 Jun 2024 15:56:04 GMT</pubDate>
    <dc:creator>KenBuja</dc:creator>
    <dc:date>2024-06-21T15:56:04Z</dc:date>
    <item>
      <title>Arcade expression fails at $layer profile</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-fails-at-layer-profile/m-p/1495565#M59806</link>
      <description>&lt;P&gt;Hi all, this is the code I am working with but I can't get past Line 3. This code worked like a charm in my old web map but I had to republish the web layers in a new map with revised schema and now it doesn't work. I've checked all the editing settings which are correct but I'm not sure how I need to fix my Playground error "$layer is not defined".&amp;nbsp; Note: This relational database is in design, so no feature data yet. Basically, when the customer feature is created the CustomerID is populated and then sequenced as below.&amp;nbsp; As I mentioned, it was working in the old map. I'm not sure where or what to check now and I can't find any examples of using $layer in all the resources on line. Would be very grateful for some advice on this! &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/611120"&gt;@bbollin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;would&amp;nbsp; you be able to point me in the direction of troubleshooting why my $layer is not defined?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you, Kristal&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;custID&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;$feature&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;CustomerID&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;numArr&lt;/SPAN&gt;&lt;SPAN&gt; = []&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Console&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;$layer&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;IsEmpty&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN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N&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;custID&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2024 15:17:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-fails-at-layer-profile/m-p/1495565#M59806</guid>
      <dc:creator>KristalWalsh</dc:creator>
      <dc:date>2024-06-21T15:17:00Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression fails at $layer profile</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-fails-at-layer-profile/m-p/1496047#M59825</link>
      <description>&lt;P&gt;Playground doesn't use a &lt;A href="https://developers.arcgis.com/arcade/profiles/" target="_self"&gt;profile&lt;/A&gt; where you can use $layer. If you click on "Profile variables", it only shows "$feature".&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Snag_af67ee.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/107659iBCEE11347E860C47/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Snag_af67ee.png" alt="Snag_af67ee.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You'll have to test out your code in a web map where you have access to more profile variables.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Snag_b1067b.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/107663iB190DFB9A8FF1D83/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Snag_b1067b.png" alt="Snag_b1067b.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2024 15:56:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-fails-at-layer-profile/m-p/1496047#M59825</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2024-06-21T15:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression fails at $layer profile</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-fails-at-layer-profile/m-p/1496065#M59826</link>
      <description>&lt;P&gt;I saw that and wasn't sure if that was indicating some problem. I understand though and have tested it in the Web Map but not sure where to look for a problem since this worked in my other map. Is there a different way to define the layer that I'm not thinking about? I understood that $layer should be specific to the layer (and all the features) of the field where the expression is being written.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2024 16:29:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-fails-at-layer-profile/m-p/1496065#M59826</guid>
      <dc:creator>KristalWalsh</dc:creator>
      <dc:date>2024-06-21T16:29:47Z</dc:date>
    </item>
  </channel>
</rss>

