Select to view content in your preferred language

Existing field name cannot be modified

96
4
Jump to solution
Monday
anbinh
by
Frequent Contributor

Hi Community,

 

"ProConcepts DDL" documentation suggests that "Field properties such as name, alias name, length, and type of some existing fields in tables or feature classes can be modified using SchemaBuilder.Modify(TableDescription, String, FieldDescription) method."

 

However, it does not seem to be the case. When I try to modify the existing field name using SchemaBuilder, I would get the error (Visual Studio .NET) saying "'Description.Name' cannot be assigned -it is read only.". The Pro SDK documentation -> Name Property (FieldDescription) also suggests that the name property is read-only. 

 

With the same dataset, however, I can change the field name in ArcGIS Pro directly. Just wondering if it should be considered as a defect that Pro SDK team should investigate? Or if there is a better way of changing the field name using SDK?

 

Regards,

 

0 Kudos
1 Solution
4 Replies
anbinh
by
Frequent Contributor

Hi,

 

Thanks for the suggestion.

 

However, the tool I am working on is a CoreHost application, hence I cannot directly call the geoprocessing tool in the code. 

 

I have done a work-around solution where I create new fields with the name I want, then use updateCursor to copy the existing fields value to the new fields. 

 

If not due to CoreHost application, I would perhaps also use the method as you suggested. 

 

Thanks,

 

0 Kudos
Aashis
by Esri Contributor
Esri Contributor

@anbinh, Please refer to the Modify(TableDescription, String, FieldDescription) method for an existing field modification. The API reference also has an example to modify a field.

0 Kudos
anbinh
by
Frequent Contributor

Hi,

 

I have read the reference. It says in the documentation that field name is read only. However, there is discrepancy in the Github ProConcepts page (ProConcepts DDL · Esri/arcgis-pro-sdk Wiki) as it suggests that field name can be changed, which I am almost certain that Github Proconcepts page needs to be corrected. 

 

Thanks,

0 Kudos