<?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 Arcade expression update field in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-update-field/m-p/1259584#M65693</link>
    <description>&lt;P&gt;&lt;SPAN&gt;I have a feature layer with a datefield (inspection_date) and a domain field (maintenance).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The datefield gets populated by related records. When a related record is added the datefield (inspection_date) in the feature layer is updated using an attribute rule.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I would like the maintenance field (which is a domain) to automatically change to ‘inspection needed’ after 20 days of the datefield, by using an attribute rule. I have the following expression, but keep getting an error. Can someone help me out.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;var numDays = 20;&lt;/DIV&gt;&lt;DIV&gt;var days = DateDiff(‘days’,Date(‘today’),&lt;SPAN&gt;$feature.inspection_date);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;If(days &amp;gt; numDays, ‘inspection needed’, $feature.maintenance)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 17 Feb 2023 22:31:21 GMT</pubDate>
    <dc:creator>pketeldijk</dc:creator>
    <dc:date>2023-02-17T22:31:21Z</dc:date>
    <item>
      <title>Arcade expression update field</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-update-field/m-p/1259584#M65693</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I have a feature layer with a datefield (inspection_date) and a domain field (maintenance).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The datefield gets populated by related records. When a related record is added the datefield (inspection_date) in the feature layer is updated using an attribute rule.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I would like the maintenance field (which is a domain) to automatically change to ‘inspection needed’ after 20 days of the datefield, by using an attribute rule. I have the following expression, but keep getting an error. Can someone help me out.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;var numDays = 20;&lt;/DIV&gt;&lt;DIV&gt;var days = DateDiff(‘days’,Date(‘today’),&lt;SPAN&gt;$feature.inspection_date);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;If(days &amp;gt; numDays, ‘inspection needed’, $feature.maintenance)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 22:31:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-update-field/m-p/1259584#M65693</guid>
      <dc:creator>pketeldijk</dc:creator>
      <dc:date>2023-02-17T22:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression update field</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-update-field/m-p/1259635#M65700</link>
      <description>&lt;UL&gt;&lt;LI&gt;You have the wrong order of arguments for &lt;A href="https://developers.arcgis.com/arcade/function-reference/date_functions/#datediff" target="_blank" rel="noopener"&gt;DateDiff&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;Date('today') isn't a thing, &lt;A href="https://developers.arcgis.com/arcade/function-reference/date_functions/#today" target="_blank" rel="noopener"&gt;Today&lt;/A&gt; is&lt;/LI&gt;&lt;LI&gt;You want to use &lt;A href="https://developers.arcgis.com/arcade/function-reference/logical_functions/#iif" target="_blank" rel="noopener"&gt;IIf&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;You're not using the correct quote marks, but some mixture of apostrophes and accents, but that might be because you posted your code as text&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="javascript"&gt;var numDays = 20;
var days = DateDiff(Today(), $feature.inspection_date, 'days');
return IIf(days &amp;gt; numDays, 'inspection needed', $feature.maintenance)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Feb 2023 11:02:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-update-field/m-p/1259635#M65700</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-02-18T11:02:40Z</dc:date>
    </item>
  </channel>
</rss>

