Field Map - Forms - Required - Yes, do not allow null values

485
3
Jump to solution
12-22-2021 02:42 PM
MarkEastwood
Occasional Contributor

Hi All,

I am trying to configure a field in one of my Field Maps forms to be required and not allow null values. But that option is not selectable for me... Is anyone else seeing this behavior?

 

MarkEastwood_0-1640212868672.png

 

Cheers

0 Kudos
1 Solution

Accepted Solutions
AaronPulver
Esri Regular Contributor

@MarkEastwoodI agree that this is confusing. The phrase "allow null values" is ambiguous in this context. We may re-consider the terminology for this in a future release.

Basically there are 2 levels of requiredness:

- The field is non-nullable. This means any app that edits features must provide a value for it. If this is the case, then when the field is added to the form, it is always required and the required setting cannot be changed. You will see "Yes, do not allow null values" for this and it's disabled.

- The field is nullable but the field is required in the form. This means that any app that is using the form should enforce that the field has a value in order to submit the edits. However, there are no database constraints which enforce this so apps which are not using the form could submit a null value for this field. You will see "Yes, allow null values" for this and can choose to change it to "No. If the field already exists in the layer, you cannot change it to "Yes, do not allow null values" (because the field is nullable already.

If you added a new form element and haven't saved the changes yet, then any of the 3 states can be selected. If you choose "No" then the field will be nullable in the database/feature layer and will not be required in the form. If you choose "Yes, allow null values", the field will be required in the form but will be non-nullable in the database. If you choose "Yes, do not allow null values", the field will be non-nullable in the database and required in the form.

Hope that clarifies it.

View solution in original post

0 Kudos
3 Replies
AaronPulver
Esri Regular Contributor

@MarkEastwoodI agree that this is confusing. The phrase "allow null values" is ambiguous in this context. We may re-consider the terminology for this in a future release.

Basically there are 2 levels of requiredness:

- The field is non-nullable. This means any app that edits features must provide a value for it. If this is the case, then when the field is added to the form, it is always required and the required setting cannot be changed. You will see "Yes, do not allow null values" for this and it's disabled.

- The field is nullable but the field is required in the form. This means that any app that is using the form should enforce that the field has a value in order to submit the edits. However, there are no database constraints which enforce this so apps which are not using the form could submit a null value for this field. You will see "Yes, allow null values" for this and can choose to change it to "No. If the field already exists in the layer, you cannot change it to "Yes, do not allow null values" (because the field is nullable already.

If you added a new form element and haven't saved the changes yet, then any of the 3 states can be selected. If you choose "No" then the field will be nullable in the database/feature layer and will not be required in the form. If you choose "Yes, allow null values", the field will be required in the form but will be non-nullable in the database. If you choose "Yes, do not allow null values", the field will be non-nullable in the database and required in the form.

Hope that clarifies it.

0 Kudos
MarkEastwood
Occasional Contributor

@AaronPulver Thanks for explaining how the required options work. I'm happy that I can still set a nullable field to required in the form.

I agree that the terminology is a bit confusing. Out of curiosity, why is it important to distinguish (in the form creation template) if a field is non-nullable in the database? It seems like this functionality is a bit over complicated. Could there not just be a required radio button that users can check on and off. If a field is required in the database the option to deselect the required radio button would be disabled.

Thanks again for the explanation!

0 Kudos
AaronPulver
Esri Regular Contributor

@MarkEastwoodThat's actually how it used to work (it was a checkbox). We recently added the ability to add new fields to your form/layer. In the case where the layer does not have any data in it, you can add a new field that is non-nullable or nullable and that decision impacts if/how the field is required in the form. We tried to unify the design for existing fields and new fields which led to this dropdown experience with 3 options.