1

while creating a feature class in ArcGIS Diagrammer I set the field id_feature_class as required and as type= text now I want to change text to integer but I can't it's telling me id_feature_class is required

how can I delete a required field in ArcGIS or change the field type from text to integer?

7
  • Perhaps these posts might help: Deleting fields and How To: Change the data type for an existing field
    – Joseph
    Commented Jun 29, 2016 at 11:41
  • @Joseph I already had a look at theses posts. I can't delete this field because it's required! I looking for a way to change the required status so I could change the data type or even delete the whole field
    – Hchliyah
    Commented Jun 29, 2016 at 11:47
  • 1
    Can you expand more what you mean by "required" and what system/app is using it and why it can not be deleted?
    – artwork21
    Commented Jun 29, 2016 at 12:03
  • @artwork21 while creating the feature class in ArcGIS Diagrammer I set the field id_feature_class as required and as type= text now I want to change text to integer or serial but I can't it's telling me id_feature_class is required
    – Hchliyah
    Commented Jun 29, 2016 at 12:12
  • Please edit your question to include those highly relevant details.
    – PolyGeo
    Commented Jun 29, 2016 at 12:15

1 Answer 1

2

According to Add Field tool help:

Fields set as required are permanent and you will not be able to delete them with future processing. To allow for deletion at a later time set the field to non-required (the default).

I think you can try to make a copy of your feature class to convert required field to non required and then create a new integer field using data from text field.

Please, do the following:

  1. Create new short integer field.
  2. Right click on the integer field and call Field calculator.
  3. Check Python box
  4. Enter this code in field calculator (replace TEXT_FIELD with your field name, see pic for more details): def convert(text): try: return int(text) except: return -9999

convert(!TEXT_FIELD!)

  1. Click OK

enter image description here

4
  • it's working for a new field, what I need is to change de type of the existing field
    – Hchliyah
    Commented Jun 29, 2016 at 12:14
  • @Hchliyah You have to make a copy of you data. This is the only way to do that. You can't alter or delete required fields. Commented Jun 29, 2016 at 12:23
  • It will change the schema of my database
    – Hchliyah
    Commented Jun 29, 2016 at 12:29
  • @Hchliyah See update at the top of the answer. Commented Jun 29, 2016 at 12:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.