<?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 custom expression in AGOL in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-custom-expression-in-agol/m-p/174674#M8560</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When using any of the Date functions, the units must be in quotes. Otherwise, it's interpreted as a variable. Try this&lt;/P&gt;&lt;P&gt;&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; inspDate &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; $feature&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"last_edited_date"&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;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;DateAdd&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;inspDate&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"year"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Today&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="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Inspection overdue'&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;else&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'OK'&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;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&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;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 09:01:37 GMT</pubDate>
    <dc:creator>KenBuja</dc:creator>
    <dc:date>2021-12-11T09:01:37Z</dc:date>
    <item>
      <title>Arcade custom expression in AGOL</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-custom-expression-in-agol/m-p/174673#M8559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to use Arcade for this first time on a hosted feature layer in AGOL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data for this layer is collected by a field crew using Collector for ArcGIS.&amp;nbsp; The last_edit_date field is automatically populated for each feature during data collection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In AGOL i want to display any features where the last edit date has exceeded a year from the current date to show that an inspection is now due on that feature.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As I've said, I'm new to Arcade but tried this expression but it doesn't seem to work correctly:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var inspDate = $feature["last_edited_date"];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (DateAdd(inspDate, 1, year) &amp;lt; Today()) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 'Inspection overdue';&lt;BR /&gt;}&lt;BR /&gt;else {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 'OK';&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any pointers on where I am going wrong or even if it is possible to do what I am trying to do?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2019 18:23:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-custom-expression-in-agol/m-p/174673#M8559</guid>
      <dc:creator>LeeButler1984</dc:creator>
      <dc:date>2019-02-20T18:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade custom expression in AGOL</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-custom-expression-in-agol/m-p/174674#M8560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When using any of the Date functions, the units must be in quotes. Otherwise, it's interpreted as a variable. Try this&lt;/P&gt;&lt;P&gt;&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; inspDate &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; $feature&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"last_edited_date"&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;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;DateAdd&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;inspDate&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"year"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Today&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="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Inspection overdue'&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;else&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'OK'&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;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:01:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-custom-expression-in-agol/m-p/174674#M8560</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-12-11T09:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade custom expression in AGOL</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-custom-expression-in-agol/m-p/174675#M8561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Ken.&amp;nbsp; This was exactly what the issue was!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2019 19:40:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-custom-expression-in-agol/m-p/174675#M8561</guid>
      <dc:creator>LeeButler1984</dc:creator>
      <dc:date>2019-02-20T19:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade custom expression in AGOL</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-custom-expression-in-agol/m-p/1209985#M47733</link>
      <description>&lt;P&gt;I realize this is an old post but i was trying to do something similar to this but I was trying to symbolize layers differently for records that were created a week or more ago; using creatdt field created from applying editor tracking. I attempted to modify above script and inserted "week" where "year" is but it is still symbolizing features that were created today. Am i missing something or is this script not meant for what i'm trying to do.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 17:11:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-custom-expression-in-agol/m-p/1209985#M47733</guid>
      <dc:creator>AriLukas</dc:creator>
      <dc:date>2022-09-06T17:11:32Z</dc:date>
    </item>
  </channel>
</rss>

