<?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: Smart Forms - Calculated Date Field - Unexpected Result in ArcGIS Experience Builder Questions</title>
    <link>https://community.esri.com/t5/arcgis-experience-builder-questions/smart-forms-calculated-date-field-unexpected/m-p/1609128#M18647</link>
    <description>&lt;P&gt;Try select the "Use webmap settings" in "&lt;SPAN&gt;Configure fields".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The "Customize" has some problem I just remember.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Allen_Zhang_0-1745547409658.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/130958iCA9DD9399D2FE00F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Allen_Zhang_0-1745547409658.png" alt="Allen_Zhang_0-1745547409658.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 25 Apr 2025 02:18:03 GMT</pubDate>
    <dc:creator>Allen_Zhang</dc:creator>
    <dc:date>2025-04-25T02:18:03Z</dc:date>
    <item>
      <title>Smart Forms - Calculated Date Field - Unexpected Result</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/smart-forms-calculated-date-field-unexpected/m-p/1609113#M18644</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;Not sure if it's me or something else on this one, but I need your help! For our workflow, I want to populate a date field with the current date and time IF (1) it should be populated based on other choices and (2) it's not already populated.&lt;/P&gt;&lt;P&gt;What I've noticed seems to be happening is that even if the date has a value, when the arcade is evaluated in Experience Builder, the value is coming back empty. This might be a bug...&lt;/P&gt;&lt;P&gt;Here's the arcade for the Check Out Time in the following screenshots.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;var checkOutTime = $feature.CheckOut;
var attendance = $feature.Attendance;
var checkOut = $feature.CheckOutChoice; 

if(attendance=='Present' &amp;amp;&amp;amp; checkOut == 'Yes'){
  if (2 == 1){
    checkOutTime = Now();
  }
}

return checkOutTime;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this example, both the check in and check out time are populated. Here's how the edit form looks in the web map.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="nulldate_webmap.jpg" style="width: 611px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/130955iA51E8EAD6E9A2FFF/image-dimensions/611x403?v=v2" width="611" height="403" role="button" title="nulldate_webmap.jpg" alt="nulldate_webmap.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And here's the same record in the edit widget in Experience Builder.&amp;nbsp; Since the check out date is coming through as null -- i'm thinking that the value isn't getting sent to the arcade expression maybe?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="nulldate_exb.jpg" style="width: 705px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/130956iE15FCBF63EFCBD30/image-dimensions/705x593?v=v2" width="705" height="593" role="button" title="nulldate_exb.jpg" alt="nulldate_exb.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The values are being shown as expected in the pop up displays ..&amp;nbsp;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="nulldate_exb_details.jpg" style="width: 687px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/130957i8027C663847DF4B1/image-dimensions/687x564?v=v2" width="687" height="564" role="button" title="nulldate_exb_details.jpg" alt="nulldate_exb_details.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any ideas you might have!&lt;/P&gt;</description>
      <pubDate>Fri, 25 Apr 2025 00:45:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/smart-forms-calculated-date-field-unexpected/m-p/1609113#M18644</guid>
      <dc:creator>jessneuner</dc:creator>
      <dc:date>2025-04-25T00:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: Smart Forms - Calculated Date Field - Unexpected Result</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/smart-forms-calculated-date-field-unexpected/m-p/1609122#M18645</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/113980"&gt;@jessneuner&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The edit widget seems like an "attribute only" mode.&lt;/P&gt;&lt;P&gt;I guess the "attribute only" mode does not support arcade expression currently.&lt;/P&gt;&lt;P&gt;I tested a "map" mode edit widget, and found the arcade fields worked.&lt;/P&gt;&lt;P&gt;Maybe you can try the map mode.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Apr 2025 01:27:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/smart-forms-calculated-date-field-unexpected/m-p/1609122#M18645</guid>
      <dc:creator>Allen_Zhang</dc:creator>
      <dc:date>2025-04-25T01:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Smart Forms - Calculated Date Field - Unexpected Result</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/smart-forms-calculated-date-field-unexpected/m-p/1609125#M18646</link>
      <description>&lt;P&gt;aaah... dang.&amp;nbsp; This is a stand alone table. hmm...&lt;/P&gt;&lt;P&gt;I have a different field with a calculation that is working great -- just this date field that's causing me trouble.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Apr 2025 02:10:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/smart-forms-calculated-date-field-unexpected/m-p/1609125#M18646</guid>
      <dc:creator>jessneuner</dc:creator>
      <dc:date>2025-04-25T02:10:33Z</dc:date>
    </item>
    <item>
      <title>Re: Smart Forms - Calculated Date Field - Unexpected Result</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/smart-forms-calculated-date-field-unexpected/m-p/1609128#M18647</link>
      <description>&lt;P&gt;Try select the "Use webmap settings" in "&lt;SPAN&gt;Configure fields".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The "Customize" has some problem I just remember.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Allen_Zhang_0-1745547409658.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/130958iCA9DD9399D2FE00F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Allen_Zhang_0-1745547409658.png" alt="Allen_Zhang_0-1745547409658.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Apr 2025 02:18:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/smart-forms-calculated-date-field-unexpected/m-p/1609128#M18647</guid>
      <dc:creator>Allen_Zhang</dc:creator>
      <dc:date>2025-04-25T02:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: Smart Forms - Calculated Date Field - Unexpected Result</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/smart-forms-calculated-date-field-unexpected/m-p/1609130#M18649</link>
      <description>&lt;LI-CODE lang="python"&gt;var checkOutTime = $feature.CheckOut;
var attendance = $feature.Attendance;
var checkOut = $feature.CheckOutChoice; 

if(attendance=='Present' &amp;amp;&amp;amp; checkOut == 'Yes'){
  if (2 == 1){
    checkOutTime = Now();
  }
}

return checkOutTime;&lt;/LI-CODE&gt;&lt;P&gt;if 2 = 1 means it will always return false? what's the point of this if statement?&lt;/P&gt;&lt;P&gt;I would recommend:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Looking at the edit modes. If the record is getting created on check-in you could use the 'INSERT' check to populate the time for when the record is created, and then not later on.&lt;/LI&gt;&lt;LI&gt;Use the $originalFeature to prevent the features from getting recalculated&lt;/LI&gt;&lt;LI&gt;Be conscious of preserving values hidden by question visibility (it's a form setting, by default they can get discarded)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;    var mode = $editcontext.editType;
    if (mode == "INSERT") {
        return now()
    } else {
        return $originalFeature.checkintime
    }  &lt;/LI-CODE&gt;&lt;P&gt;and&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var CheckedOut = $feature.CheckedOut;  // Checked out 'Yes'?
var OriginalCheckOutTime = $originalFeature.CheckOutTime;  // current checkout time on form load

// Check if CheckedOut is 'Yes' and CheckOut time is currently empty
if (CheckedOut == 'Yes' &amp;amp;&amp;amp; IsEmpty(OriginalCheckOutTime)) {
    return Now();
} else {
    return OriginalCheckOutTime// Use $originalFeature to get the original field value which would be null or the first checkout time calculated
}&lt;/LI-CODE&gt;&lt;P&gt;Some of syntax might not quite be right sorry just writing this off memory on the forum &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Apr 2025 03:02:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/smart-forms-calculated-date-field-unexpected/m-p/1609130#M18649</guid>
      <dc:creator>ChristopherCounsell</dc:creator>
      <dc:date>2025-04-25T03:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: Smart Forms - Calculated Date Field - Unexpected Result</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/smart-forms-calculated-date-field-unexpected/m-p/1609198#M18650</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/832963"&gt;@Allen_Zhang&lt;/a&gt;&amp;nbsp;Does seem like an Attribute_only vs map thing.&amp;nbsp; Did a similar test with a feature layer instead of stand alone table this morning and saw the same behavior (just a simple pass through of the value with the arcade calculation) and they didn't pass through in attribute only mode, but did in the map side.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;bummer!&amp;nbsp; i have a Survery123 version of the logic that works great - the UX isn't quite as nice as the edit widget but will get the job done!&lt;/P&gt;&lt;P&gt;appreciate your help!&lt;/P&gt;</description>
      <pubDate>Fri, 25 Apr 2025 12:42:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/smart-forms-calculated-date-field-unexpected/m-p/1609198#M18650</guid>
      <dc:creator>jessneuner</dc:creator>
      <dc:date>2025-04-25T12:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: Smart Forms - Calculated Date Field - Unexpected Result</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/smart-forms-calculated-date-field-unexpected/m-p/1609200#M18651</link>
      <description>&lt;P&gt;thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/412943"&gt;@ChristopherCounsell&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;&lt;P&gt;I appreciate you taking a look -- the 2=1 came about because I was confused why it was always updating the date to Now even when it was already populated, so wanted it to skip that part and that's when I realized -- is it not even getting the date??&lt;/P&gt;&lt;P&gt;Thank you for the tip on edit mode also!&amp;nbsp; I wound up going down that rabbit hole last night as well -- and all the visibility stuff ... I realized that even if values are hidden those calculations are getting executed which i hadn't expected ... learning a lot!&lt;/P&gt;</description>
      <pubDate>Fri, 25 Apr 2025 12:46:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/smart-forms-calculated-date-field-unexpected/m-p/1609200#M18651</guid>
      <dc:creator>jessneuner</dc:creator>
      <dc:date>2025-04-25T12:46:19Z</dc:date>
    </item>
  </channel>
</rss>

