<?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: Using Arcade to calculate a field based on the value of another field in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/using-arcade-to-calculate-a-field-based-on-the/m-p/1331295#M6761</link>
    <description>&lt;P&gt;Duh, I overlooked that. Weirdly enough the field populates in map viewer but not in field maps.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Sep 2023 23:14:18 GMT</pubDate>
    <dc:creator>AlcoGISUser</dc:creator>
    <dc:date>2023-09-21T23:14:18Z</dc:date>
    <item>
      <title>Using Arcade to calculate a field based on the value of another field</title>
      <link>https://community.esri.com/t5/developers-questions/using-arcade-to-calculate-a-field-based-on-the/m-p/1331247#M6759</link>
      <description>&lt;P&gt;I'm creating a smart form for Field Maps and one of the requirements is to toggle one of the entries to either "Yes" or "No" using a switch. I have the default value set to "No". If the person in the field toggles the switch to "Yes" I want an Arcade expression to update the value for that same record in a date field with the current date of when the switch was toggled to "Yes" for that record.&lt;/P&gt;&lt;P&gt;I tried this but got an error:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;inspection_date&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;DATE_INSPECTED&lt;/SPAN&gt;&lt;SPAN&gt;; /// date field to be changed with Arcade expression&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;inspected&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;INSPECTED&lt;/SPAN&gt;&lt;SPAN&gt;; /// toggle switch field&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;IIf&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;inspected&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;"Yes"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;inspection_date&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;Today&lt;/SPAN&gt;&lt;SPAN&gt;(), &lt;/SPAN&gt;&lt;SPAN&gt;null&lt;/SPAN&gt;&lt;SPAN&gt;); /// condition&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;The error I get is:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Test execution error: Execution error - undefined. Verify test data.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I think I may need to use a for loop to achieve this but not sure how a response in a smart form would trigger the expression. Is this even possible?&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 21 Sep 2023 20:02:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/using-arcade-to-calculate-a-field-based-on-the/m-p/1331247#M6759</guid>
      <dc:creator>AlcoGISUser</dc:creator>
      <dc:date>2023-09-21T20:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to calculate a field based on the value of another field</title>
      <link>https://community.esri.com/t5/developers-questions/using-arcade-to-calculate-a-field-based-on-the/m-p/1331254#M6760</link>
      <description>&lt;P&gt;When writing any logical function (either IF or IFF), you have to use "==" when evaluating a condition&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var inspection_date = $feature.DATE_INSPECTED; /// date field to be changed with Arcade expression
var inspected = $feature.INSPECTED; /// toggle switch field
IIf(inspected == "Yes", inspection_date = Today(), null); /// condition&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 20:15:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/using-arcade-to-calculate-a-field-based-on-the/m-p/1331254#M6760</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2023-09-21T20:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to calculate a field based on the value of another field</title>
      <link>https://community.esri.com/t5/developers-questions/using-arcade-to-calculate-a-field-based-on-the/m-p/1331295#M6761</link>
      <description>&lt;P&gt;Duh, I overlooked that. Weirdly enough the field populates in map viewer but not in field maps.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 23:14:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/using-arcade-to-calculate-a-field-based-on-the/m-p/1331295#M6761</guid>
      <dc:creator>AlcoGISUser</dc:creator>
      <dc:date>2023-09-21T23:14:18Z</dc:date>
    </item>
  </channel>
</rss>

