<?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: Update Field with Date Type to Null Value in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/update-field-with-date-type-to-null-value/m-p/1105958#M250</link>
    <description>&lt;P&gt;Can you try your rule on a FileGDB? see if you experience the behavior. If you don't, then we know this bug was fixed in 2.8 and Enterprise 10.9 will have the fix.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 08 Oct 2021 15:18:11 GMT</pubDate>
    <dc:creator>HusseinNasser2</dc:creator>
    <dc:date>2021-10-08T15:18:11Z</dc:date>
    <item>
      <title>Update Field with Date Type to Null Value</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/update-field-with-date-type-to-null-value/m-p/1105775#M244</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to transfer date data from a source feature class to a target feature class using an Arcade Dictionary to update the date field in the target class. Some of the features in the source class have blank\null value in the date field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;When the rule finds one source features with a blank\null field it raises and error saying that the value passed by the dictionary to the field is not the right type. Even when the date field in the target is set to allow null values.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, I found that setting the date field value in the dictionary explicitly to null will avoid the error, but the value was set to "12/30/1899" in the target date field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why is not possible to set date field value to null using an Arcade Dictionary?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 02:19:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/update-field-with-date-type-to-null-value/m-p/1105775#M244</guid>
      <dc:creator>Billy</dc:creator>
      <dc:date>2021-10-08T02:19:23Z</dc:date>
    </item>
    <item>
      <title>Re: Update Field with Date Type to Null Value</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/update-field-with-date-type-to-null-value/m-p/1105882#M245</link>
      <description>&lt;P&gt;Any chance you could share the code being used here? It's hard to understand how your process is breaking down without some more specifics. If you're just updating a single field, why use a dictionary? Couldn't you pipe the value straight from one to the other? And use an &lt;STRONG&gt;if &lt;/STRONG&gt;statement to skip the null values?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 13:35:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/update-field-with-date-type-to-null-value/m-p/1105882#M245</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-10-08T13:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: Update Field with Date Type to Null Value</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/update-field-with-date-type-to-null-value/m-p/1105930#M246</link>
      <description>&lt;P&gt;Hi Josh,&lt;/P&gt;&lt;P&gt;Thanks for your answer. Below you can see the section of the code where the assignment is done and the returned dictionary is defined. Before this section the code is just finding the closest source feature, which is not related to the problem.&lt;/P&gt;&lt;P&gt;As you can see, I'm updating multiple fields, hence the used of the dictionary. The IF statement is the workaround that I mentioned in the third paragraph of my original question.&lt;/P&gt;&lt;P&gt;Below you can see images with the field view in ArcGIS Pro for the source class and the target class.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Extract fuse attributes from closest source feature
		var fuse_addpowerrating = closestf['Bayonet_fuse_rated_amp']                    		// This is the fuse rated current
		var fuse_installdate = closestf['InstallationDate']                   			 				// Fuse installation date
		var fuse_inservice_date = closestf['TapDate']               								// Fuse inservice date
		var phasesnormal = transf_phase                                                    						// Domain assign to field
		var phasescurrent = transf_phase                                                   						// Domain assign to field
		var phasessummer = transf_phase                                                   						 	// Domain assign to field
		var phaseswinter = transf_phase                                                   							 // Domain assign to field  
		
		if (IsEmpty(fuse_installdate) || IsEmpty(fuse_inservice_date) )  {
			fuse_inservice_date = null
			fuse_installdate = null
		}		

		// Return dictionary with the data to transfer to the target feature
		return {
			'result': field_value,
			'edit':[
				{
				//updates the fuse feature attributes
				'className': 'UN_MODEL_V34.MODEL_V34.ElectricDevice',
				'updates': [{
					'globalID': $feature.globalID,
					'attributes': {
						'phasesnormal': phasesnormal,
						'phasescurrent': phasescurrent,
						'phasessummer': phasessummer,
						'phaseswinter': phaseswinter,						
						'addpowerrating': fuse_addpowerrating,
						'installdate': fuse_installdate,
						'inservicedate': fuse_inservice_date,
						//'model': fuse_model                                                    
					}
				}]
				}				
			]
		}
	}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Source Feature Date Fields&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Billy_1-1633704419744.png" style="width: 749px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/24847iAC3251863AF4FCB0/image-dimensions/749x386?v=v2" width="749" height="386" role="button" title="Billy_1-1633704419744.png" alt="Billy_1-1633704419744.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Target Feature Date Fields&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Billy_0-1633704191516.png" style="width: 766px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/24846iA0C18164D0E19A9A/image-dimensions/766x158?v=v2" width="766" height="158" role="button" title="Billy_0-1633704191516.png" alt="Billy_0-1633704191516.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 14:49:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/update-field-with-date-type-to-null-value/m-p/1105930#M246</guid>
      <dc:creator>Billy</dc:creator>
      <dc:date>2021-10-08T14:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: Update Field with Date Type to Null Value</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/update-field-with-date-type-to-null-value/m-p/1105945#M247</link>
      <description>&lt;P&gt;Hey Billy,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know which ArcGIS Pro/Enterprise you are running?&amp;nbsp;&lt;/P&gt;&lt;P&gt;We had a bug with Null persistence in Arcade that we fixed in Pro 2.8 (Enterprise 10.9).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 15:02:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/update-field-with-date-type-to-null-value/m-p/1105945#M247</guid>
      <dc:creator>HusseinNasser2</dc:creator>
      <dc:date>2021-10-08T15:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: Update Field with Date Type to Null Value</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/update-field-with-date-type-to-null-value/m-p/1105952#M248</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm running Pro 2.8, but Enterprise 10.8.1&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 15:11:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/update-field-with-date-type-to-null-value/m-p/1105952#M248</guid>
      <dc:creator>Billy</dc:creator>
      <dc:date>2021-10-08T15:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Update Field with Date Type to Null Value</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/update-field-with-date-type-to-null-value/m-p/1105953#M249</link>
      <description>&lt;P&gt;So, what about using the if a little differently, and just omit the field entirely if the value is null? Also, by establishing the attributes dict &lt;STRONG&gt;atts&lt;/STRONG&gt; directly, you can just skip past creating all those intermediate vars.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var atts = {
    'phasesnormal': transf_phase,
    'phasescurrent': transf_phase,
    'phasessummer': transf_phase,
    'phaseswinter': transf_phase,
    'addpowerrating': closestf['Bayonet_fuse_rated_amp']
}

if(IsEmpty(closestf['InstallationDate'])){
    atts['installdate'] = closestf['InstallationDate']
}

if(IsEmpty(closestf['TapDate'])){
    atts['inservicedate'] = closestf['TapDate']
}

return {
    'result': field_value,
    'edit':[{
        //updates the fuse feature attributes
        'className': 'UN_MODEL_V34.MODEL_V34.ElectricDevice',
        'updates': [{
            'globalID': $feature.globalID,
            'attributes': atts                                              
            }
        }]
    }]
}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 15:15:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/update-field-with-date-type-to-null-value/m-p/1105953#M249</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-10-08T15:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: Update Field with Date Type to Null Value</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/update-field-with-date-type-to-null-value/m-p/1105958#M250</link>
      <description>&lt;P&gt;Can you try your rule on a FileGDB? see if you experience the behavior. If you don't, then we know this bug was fixed in 2.8 and Enterprise 10.9 will have the fix.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 15:18:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/update-field-with-date-type-to-null-value/m-p/1105958#M250</guid>
      <dc:creator>HusseinNasser2</dc:creator>
      <dc:date>2021-10-08T15:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: Update Field with Date Type to Null Value</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/update-field-with-date-type-to-null-value/m-p/1105963#M251</link>
      <description>&lt;P&gt;I will test it and get back to yo with the result.&lt;/P&gt;&lt;P&gt;Let me take the opportunity to see if you can take a look at this question that I posted about copying attachments with Arcade:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/attribute-rules-questions/copy-pictures-taken-with-field-maps-to-utility/m-p/1105399" target="_blank"&gt;Copy Pictures Taken with Field Maps to Utility Net... - Esri Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 15:23:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/update-field-with-date-type-to-null-value/m-p/1105963#M251</guid>
      <dc:creator>Billy</dc:creator>
      <dc:date>2021-10-08T15:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: Update Field with Date Type to Null Value</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/update-field-with-date-type-to-null-value/m-p/1105981#M252</link>
      <description>&lt;P&gt;Hi Josh,&lt;/P&gt;&lt;P&gt;Your code looks like another way to avoid the error with lest code, and it should save me the work to find all the feature that were assigned the date "12/30/1899" and replace it with a field calculation process in the attribute table.&lt;/P&gt;&lt;P&gt;I will test it and report back the result.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 15:53:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/update-field-with-date-type-to-null-value/m-p/1105981#M252</guid>
      <dc:creator>Billy</dc:creator>
      <dc:date>2021-10-08T15:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: Update Field with Date Type to Null Value</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/update-field-with-date-type-to-null-value/m-p/1106007#M253</link>
      <description>&lt;P&gt;Test went well. But I made a small change to the IF statements. It should be " If Not Empty" --&amp;gt; If (!IsEmpty()){}&lt;/P&gt;&lt;P&gt;Here is the updated code:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var atts = {
	'phasesnormal': transf_phase,
	'phasescurrent': transf_phase,
	'phasessummer': transf_phase,
	'phaseswinter': transf_phase,
	'addpowerrating': closestf['Bayonet_fuse_rated_amp']
    }
    
    if(!IsEmpty(closestf['InstallationDate'])){
	atts['installdate'] = closestf['InstallationDate']
    }
    
    if(!IsEmpty(closestf['TapDate'])){
	atts['inservicedate'] = closestf['TapDate']
    }
    
    return {
	'result': field_value,
	'edit':[{
	    //updates the fuse feature attributes
	    'className': 'UN_MODEL_V34.MODEL_V34.ElectricDevice',
	    'updates': [{
		'globalID': $feature.globalID,
		'attributes': atts                                              
		}
	    }]
	}]
    }
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 17:00:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/update-field-with-date-type-to-null-value/m-p/1106007#M253</guid>
      <dc:creator>Billy</dc:creator>
      <dc:date>2021-10-08T17:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: Update Field with Date Type to Null Value</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/update-field-with-date-type-to-null-value/m-p/1106659#M255</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;It work well in a FGDB. No error.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Oct 2021 11:36:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/update-field-with-date-type-to-null-value/m-p/1106659#M255</guid>
      <dc:creator>Billy</dc:creator>
      <dc:date>2021-10-12T11:36:17Z</dc:date>
    </item>
  </channel>
</rss>

