Can't set integer to null with Feature Service REST update

3590
12
09-07-2012 07:18 AM
by Anonymous User
Not applicable
Original User: oppedahl

I have a feature class published to a Feature Service with one of its attributes a nullable integer with no default value defined. I'm trying to edit the attribute with the REST API's Update operation. It works if I set it to a number, but saving null doesn't work. There's no error--the call goes through fine--but the value remains unchanged. Is it not allowed to set a numeric field to null once it's been set to something else? I can set it to null just fine in ArcMap. Here's a snippet of the JSON I'm sending to the update:

[
{
   "attributes": {
    "OBJECTID_1": 1234,
    "AnInt": null,
   }
  }
]
0 Kudos
12 Replies
by Anonymous User
Not applicable
Original User: oppedahl

Bump. Anyone from ESRI? I can blank out a string field by setting it to an empty string, but how do I blank out other data types since null appears to be ignored?
0 Kudos
JayPaige
New Contributor
Ditto.  I am unable to set integers to null since null parameters appear to be ignored. 

Below is my json (captured directly by Fiddler), and I am unable to update the fields HabitGroup and PlantCount to null.  As you can see, they are included in the json.

updates=[{"geometry":null,"attributes":{"OBJECTID":78433,"PlantingNumber":"2012-0698-1","TaxonName":"Boltonia asteroides 'Pink Beauty' ","PrimaryCommonName":"false aster","GridCoordinates":null,"HabitGroup":null,"Honoree":null,"PlantCount":null,"GardenArea":"KCLA","GardenBed":"","created_user":null,"last_edited_user":null,"created_date":null,"last_edited_date":null}}]&f=json
0 Kudos
by Anonymous User
Not applicable
Original User: oppedahl

Help ESRI!
0 Kudos
NilsRydh
New Contributor
I'm having the same problem with fields of the type 'date'.
If I send this JSON:
"Systime_from": 1195826644000,
"Systime_to": null

These are the field definitions:
Systime_from ( type: esriFieldTypeDate , alias: Systime_from , editable: true , nullable: false , length: 36 )
Systime_to ( type: esriFieldTypeDate , alias: Systime_to , editable: true , nullable: true , length: 36 )

The 'Systime_to' will be set to the Jan 1, 1970 in the database, so it seems like it is treated as '0' and then parsed to a date.
If I omit this attribute in the request, the attribute is not updated.

It looks like the same issue, as the datetime here is also an integer.

Is this a bug, or what is the correct way to update an attribute to NULL?
0 Kudos
by Anonymous User
Not applicable
Original User: KG22

I am experiencing similar
0 Kudos
by Anonymous User
Not applicable
Original User: oppedahl

This is still a breaking issue for our application, and there doesn't seem to be a workaround. Are we missing something or is this a bug in the REST service?
0 Kudos
NilsRydh
New Contributor
Does anybody know if this has been reported to the secret Esri bug database?
0 Kudos
by Anonymous User
Not applicable
Original User: kpeter

It would be best if you contacted Esri Support.  One of our engineers in development just tried this and was not able to replicate the problem.  We'd need to know all the details (versions of software used, database...) to truly replicate and debug, so Support is the place to collect this information and get the ball rolling.
0 Kudos
GaryMacDougall
Esri Contributor
One thing to check is the server log. It may have more detailed information on why you are getting an error.

thanks
Gary
0 Kudos