<?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 Error in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-error/m-p/1504739#M85507</link>
    <description>&lt;P&gt;Thanks very much, ideal...&lt;/P&gt;</description>
    <pubDate>Fri, 12 Jul 2024 12:39:28 GMT</pubDate>
    <dc:creator>AndyIngall</dc:creator>
    <dc:date>2024-07-12T12:39:28Z</dc:date>
    <item>
      <title>Arcade Expression Error</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-error/m-p/1504730#M85504</link>
      <description>&lt;P&gt;I have the following Arcade expression to calculate the difference between two dates&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var DateRec = $feature.DATEAPRECV
var DateVal =$feature.DATEAPVAL
var ValDays = DateDiff(DateVal, DateRec, 'Days');
return ValDays + " day";&lt;/LI-CODE&gt;&lt;P&gt;What i have tried&amp;nbsp; &amp;nbsp;to do is add in an IF clause to change the day to days if ValDays =&amp;gt; 2 but get errors regard parenthesis&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var DateRec = $feature.DATEAPRECV
var DateVal =$feature.DATEAPVAL
var ValDays = DateDiff(DateVal, DateRec, 'Days');
if (ValDays = 1)
return ValDays + " day";
else if (ValDays =&amp;gt; 2)
return ValDays + " days";&lt;/LI-CODE&gt;&lt;P&gt;The error is&amp;nbsp;&lt;/P&gt;&lt;P&gt;Invalid expression.&lt;BR /&gt;Error on line 4.&lt;BR /&gt;Close parenthesis expected&lt;/P&gt;&lt;P&gt;Can anyone please explain what is wrong??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2024 12:23:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-error/m-p/1504730#M85504</guid>
      <dc:creator>AndyIngall</dc:creator>
      <dc:date>2024-07-12T12:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression Error</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-error/m-p/1504737#M85505</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/702651"&gt;@AndyIngall&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems that your comparison operator is in the wrong order and you may be attempting to make an assignment instead of a comparison in your if statement, you would also need to include curly brackets as this is required to encapsulate any return statement, this is what I ended up getting to work here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var DateRec = $feature.DATEAPRECV;
var DateVal = $feature.DATEAPVAL;
var ValDays = DateDiff(DateVal, DateRec, 'Days');

if (ValDays == 1) {
    return ValDays + " day";
} else if (ValDays &amp;gt;= 2) {
    return ValDays + " days";
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps!&lt;/P&gt;&lt;P&gt;Cody&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2024 12:31:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-error/m-p/1504737#M85505</guid>
      <dc:creator>CodyPatterson</dc:creator>
      <dc:date>2024-07-12T12:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression Error</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-error/m-p/1504739#M85507</link>
      <description>&lt;P&gt;Thanks very much, ideal...&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2024 12:39:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-error/m-p/1504739#M85507</guid>
      <dc:creator>AndyIngall</dc:creator>
      <dc:date>2024-07-12T12:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression Error</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-error/m-p/1504751#M85509</link>
      <description>&lt;P&gt;You could also use this syntax&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var DateRec = $feature.DATEAPRECV;
var DateVal = $feature.DATEAPVAL;
var ValDays = DateDiff(DateVal, DateRec, 'Days');

return `${ValDays } ${iif(Abs(ValDays) == 1, 'day', 'days')}`&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2024 17:54:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-error/m-p/1504751#M85509</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2024-07-12T17:54:39Z</dc:date>
    </item>
  </channel>
</rss>

