Select to view content in your preferred language

Re: How to handle default date values in AGOL

170
2
Jump to solution
11-06-2024 07:22 AM
OliviaE
Occasional Contributor

@EmilyGeo it looks like it is when I import the csv to a geodatabase table. The csv has nulls and the gdb table has the default value in the field. But I thought I set up my script to allow for nulls in the fields.

How I set up the table fields:

arcpy.management.AddFields(TrakitDBTable,[['PERMIT_NO', 'TEXT', 'Permit Number',50, 'NULL',''],['SITE_ADDR', 'TEXT', 'Address', 250,'NULL', ''],['SITE_APN', 'TEXT','Site APN',50, 'NULL',''],['PermitType','TEXT','Permit Type',50,'NULL',''],['PermitSubType', 'TEXT','Permit Sub Type',50,'NULL',''],['APPLIED','DATE','Applied Date','',None,''],['APPROVED','DATE','Approved Date','',None,''],['ISSUED','DATE','Issued Date','',None,''],['FINALED','DATE','Finaled Date','',None,''],['LON','DOUBLE','X_DecimalDegrees','','',''],['LAT','DOUBLE','Y_DecimalDegrees','','','']])
 
The field mapping from csv to gdb table:
 
fieldmapstring = 'PERMIT_NO "Permit Number" true true false 50 TEXT-1 -1,First,#,<csv location string>,PERMIT_NO,-1,-1;SITE_ADDR "Address" true true false 50 TEXT -1 -1,First,#,<csv location string>,SITE_ADDR,-1,-1;SITE_APN "Site APN" true true false 50 TEXT -1 -1,First,#,<csv location string>,SITE_APN,-1,-1;PermitType "Permit Type" true true false 50 TEXT -1 -1,First,#,<csv location string>,PermitType,-1,-1;PermitSubType "Permit Subtype" true true false 50 TEXT -1 -1,First,#,<csv location string>,PermitSubType,-1,-1;APPLIED "Applied Date" true true false -1 DATE -1 -1,First,#,<csv location string>,APPLIED,-1,-1;APPROVED "Approved Date" true true false -1 DATE -1 -1,First,#,<csv location string>,APPROVED,-1,-1;ISSUED "Issued Date" true true false -1 DATE -1 -1,First,#,<csv location string>,ISSUED,-1,-1;FINALED "Finaled Date" true true false -1 DATE -1 -1,First,#,<csv location string>,FINALED,-1,-1;LON "X_DecimalDegrees" true true false -1 DOUBLE -1 -1,First,#,<csv location string>,LON,-1,-1;LAT "Y_DecimalDegrees" true true false -1 DOUBLE -1 -1,First,#,<csv location string>,LAT,-1,-1'
0 Kudos
1 Solution

Accepted Solutions
OliviaE
Occasional Contributor

@EmilyGeo Hi! So I did figure out a solution, for me. I just need to recalculate the fields to be null after I import it to the database. Once they are calculated to null, it persists through the process to AGOL so I now have empty values instead of 12/30/1899 which is what I wanted. Just a couple extra lines of code, not sure if it was the most efficient way, but it works! Thanks for your help!

View solution in original post

2 Replies
EmilyGeo
Esri Contributor

Hi @OliviaE

I think you need to ensure that the new Date fields support Null values when you add them.

Moving this discussion to the Python Community for now...

0 Kudos
OliviaE
Occasional Contributor

@EmilyGeo Hi! So I did figure out a solution, for me. I just need to recalculate the fields to be null after I import it to the database. Once they are calculated to null, it persists through the process to AGOL so I now have empty values instead of 12/30/1899 which is what I wanted. Just a couple extra lines of code, not sure if it was the most efficient way, but it works! Thanks for your help!