Select to view content in your preferred language

In a feature class, can "allow null values" be conditional?

2812
5
08-29-2017 12:15 PM
AliciaRitzenthaler
Occasional Contributor

In a feature class, can "allow null values" be conditional? Is there a way for example, to allow null values in Field 2 if Field 1 is X but not allow null values in Field 2 if Field 1 is Y (assuming no null values are allowed in Field 1)? If so, how and where does one define this?

0 Kudos
5 Replies
MicahBabinski
Frequent Contributor

Hi Alicia,

As I understand it, the Allow Null Values property of a field in a geodatabase feature class or table is part of the underlying schema and therefore cannot be changes on the fly. What kind of editing will your users be doing where you want to implement this behavior? I have heard that Survey123 for ArcGIS can implement this kind of custom behavior in a configurable (non-code) way.

If it's for a mobile application but Survey123 doesn't work, you could probably program this custom behavior using one of several ArcGIS Runtime SDKs.

Finally, if your editing needs to happen in desktop, I think the best way to do that would still be to implement a custom Geodatabase Class Extension using ArcObjects.

I can definitely see how it would be nice to have this ability to implement conditional schema properties in the geodatabase. I guess since there's so many layers that sit on top of the geodatabase (mxds, services, web maps, applications, etc) Esri is nudging customers in the direction of implementing this custom behavior at the application level.

Good luck - let us know what direction you end up going.

Micah

0 Kudos
AliciaRitzenthaler
Occasional Contributor

We are actually setting up this feature class to be the editable layer in a Collector for GIS application. The hope was that we could require/not require fields when certain conditions were met (by allowing or not allowing null values) to enhance data verification/validation efforts during field collection especially since there does not seem to be a way to enable/disable fields conditional (or at all for that matter). 

Survey123 is a most excellent tool for accomplishing these specific goals but unfortunately doesn't offer the interactive mapping we also desire. If only there was a way to fuse the two platforms...

0 Kudos
MicahBabinski
Frequent Contributor

Yeah, in that case you are probably looking at needing to develop something custom using ArcGIS Runtime SDK for Android or iOS. Just another reason mobile app developers with solid GIS backgrounds are in such high demand these days, I suppose!

DanPatterson_Retired
MVP Emeritus

Creating a field that allows nulls will fill the field with null... if some other field X has some value and you don't want another field Y to be null... then what do you want it to be? some other value? (it can't be empty, a space would be bad, )

  This type of situation is best handled as a field calculator expression so that you have control

AliciaRitzenthaler
Occasional Contributor

We hoped to try to use allow/don't allow nulls to essentially allow us to conditionally require fields while collecting data in the field using Collector for GIS (see reply to Micah Bibinski above).

0 Kudos