How to create field without Geoprocessing tool ?

485
1
10-08-2018 05:22 AM
tanerkoka
Occasional Contributor II

Hi,

We are developing tool in Arcgis Pro sdk .We have feature class and we are creates lot of fields using Geoprocessing tools like below in code. But when we use geoprocessing tool (management.AddField) and when we ctreate in order fields are very slow created. How can I solve this Geoprocessing tool (management.AddField)  slowness problem or can I ctreate fields by another way using pro sdk without Geoprocessing tool (management.AddField) ? Here are the code example (Adding two field in feature class) below:

Layer layer = MapView.Active.Map.FindLayers(nameOfShape).FirstOrDefault();

FeatureLayer featureLayer = layer as FeatureLayer;


Table table = (layer as FeatureLayer).GetTable();

int fieldLength = 15;
bool isNullable = true;
var parameters = Geoprocessing.MakeValueArray(tableName, "NAME", "TEXT", null, null,
fieldLength, "Name", isNullable ? "NULABLE" : "NON_NULLABLE");

var results = Geoprocessing.ExecuteToolAsync("management.AddField", parameters);

int fieldLength1 = 15;
var parameters1 = Geoprocessing.MakeValueArray(tableName, "IDREF", "TEXT", null, null,
fieldLength1, "Id Ref", isNullable ? "NULABLE" : "NON_NULLABLE");

var results1 = Geoprocessing.ExecuteToolAsync("management.AddField", parameters1);

.

.

.

.

.

.

etc.

Thanks for helping

0 Kudos
1 Reply
RichRuh
Esri Regular Contributor

The Pro SDK does not support DDL (data definition language) tasks such as adding fields or creating feature classes.  You need to use Python or geoprocessing to perform these operations.