topic Re: Create a double field using the DDL in ArcGIS Pro SDK Questions //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1073112#M6808 < P > Hello  < a href = " //www.gamepadva.com/t5/user/viewprofilepage/user-id/12882">@Wolf 

 

Here is the code, note that the database is a memory database.

And yet the result is: 

 

private async Task CreateParcelTempLayers(Polygon parcelGeometry, bool shouldGeneralize) { var memoryConnectionProperties = new MemoryConnectionProperties(); var map = MapView.Active.Map; using var geodatabase = SchemaBuilder.CreateGeodatabase(memoryConnectionProperties); BuildEdgesLayer(map, geodatabase); } // and bellow private void BuildEdgesLayer(Map map, Geodatabase geodatabase) { var shapeDescription = new ShapeDescription(GeometryType.Polyline, map.SpatialReference); var fieldDescriptions = new[] { new FieldDescription(m_FromVertexToVertex, FieldType.String){Length = 50}, new FieldDescription(m_EdgeLength, FieldType.Double) { Scale = 2, Precision = 9, AliasName = ReportsManagerResources.ReportsManagerProxy_BuildEdgesLayer_DistancesAlias }, }; var featureClassDescription = new FeatureClassDescription(m_ParcelEdgesLayerName, fieldDescriptions, shapeDescription); var schemaBuilder = new SchemaBuilder(geodatabase); schemaBuilder.Create(featureClassDescription); var success = schemaBuilder.Build(); }

 image.png

 

Would love to hear your feedback

Mon, 28 Jun 2021 08:41:18 GMT dkuida 2021-06-28T08:41:18Z Create a double field using the DDL //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1071947#M6793

Hello all

We are trying to create layer with field with type double using the new DDL

The field in in  layer in sql server.

It looks like the code ignore the scale and precision. 

Trying to do the same with GP tool (Add Field) works.

Is this a bug, feature or something that will come in the next version?

Thanks

Thu, 24 Jun 2021 12:32:39 GMT //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1071947#M6793 mody_buchbinder 2021-06-24T12:32:39Z
Re: Create a double field using the DDL //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1072194#M6797

Hi @mody_buchbinder , Could you please send us a code snippet that causing the issue? We are not able to reproduce the scenario that doesn't honor the scale and precision provided through DDL.

Version info of Pro and SQL Server are also helpful for further diagnosis. 

The following field description successfully created a double field with scale and precision in our test.

 

FieldDescription doubleFieldDescription = new FieldDescription("TestDoubleField", FieldType.Double) { Scale = 3, Precision = 9 };

 

AashisLamsal1_0-1624558060157.jpeg

 

Thu, 24 Jun 2021 19:28:37 GMT //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1072194#M6797 Aashis 2021-06-24T19:28:37Z
Re: Create a double field using the DDL //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1072260#M6800

Thanks for reporting this.  I was able to duplicate this problem.   I will report the issue to the Geodatabase team.

Thu, 24 Jun 2021 22:01:48 GMT //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1072260#M6800 Wolf 2021-06-24T22:01:48Z
Re: Create a double field using the DDL //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1072351#M6802

I stand corrected.  The Geodatabase team pointed out the error in my test add-in where I chose a scale larger than the precision.  Once I fixed that error I get the proper result:

Wolf_0-1624571868016.png

 

I used the following code snippet to create the feature class.  The 'selectedFeatureLayer' is a feature layer I get from the TOC in order to get my database connection.

var selectedLayerTable = selectedFeatureLayer.GetTable(); var testName = $@"Point{DateTime.Now:HHmmss}"; var hasZ = false; var hasM = false; // Create a ShapeDescription object var shapeDescription = new ShapeDescription(GeometryType.Point, SpatialReferences.WebMercator) { HasM = hasM, HasZ = hasZ }; var objectIDFieldDescription = new ArcGIS.Core.Data.DDL.FieldDescription("ObjectID", FieldType.OID); var stringFieldDescription = new ArcGIS.Core.Data.DDL.FieldDescription("TheString", FieldType.String); var intFieldDescription = new ArcGIS.Core.Data.DDL.FieldDescription("TheInteger", FieldType.Integer); var dblFieldDescription = new ArcGIS.Core.Data.DDL.FieldDescription("TheDouble", FieldType.Double) { Precision = 9, Scale = 5 }; var dateFieldDescription = new ArcGIS.Core.Data.DDL.FieldDescription("TheDate", FieldType.Date); using (var geoDb = selectedLayerTable.GetDatastore() as Geodatabase) { var fcName = $@"{testName}"; try { // Assemble a list of all of our field descriptions var fieldDescriptions = new List<ArcGIS.Core.Data.DDL.FieldDescription>() { objectIDFieldDescription, stringFieldDescription, intFieldDescription, dblFieldDescription, dateFieldDescription }; // Create a FeatureClassDescription object to describe the feature class to create var fcDescription = new FeatureClassDescription(fcName, fieldDescriptions, shapeDescription); // Create a SchemaBuilder object SchemaBuilder schemaBuilder = new SchemaBuilder(geoDb); // Add the creation of the Cities feature class to our list of DDL tasks schemaBuilder.Create(fcDescription); // Execute the DDL bool success = schemaBuilder.Build(); } catch (Exception ex) { MessageBox.Show($@"Exception: {ex}"); } }

 

Thu, 24 Jun 2021 22:01:06 GMT //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1072351#M6802 Wolf 2021-06-24T22:01:06Z
Re: Create a double field using the DDL //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1073112#M6808 < P > Hello  < a href = " //www.gamepadva.com/t5/user/viewprofilepage/user-id/12882">@Wolf 

 

Here is the code, note that the database is a memory database.

And yet the result is: 

 

private async Task CreateParcelTempLayers(Polygon parcelGeometry, bool shouldGeneralize) { var memoryConnectionProperties = new MemoryConnectionProperties(); var map = MapView.Active.Map; using var geodatabase = SchemaBuilder.CreateGeodatabase(memoryConnectionProperties); BuildEdgesLayer(map, geodatabase); } // and bellow private void BuildEdgesLayer(Map map, Geodatabase geodatabase) { var shapeDescription = new ShapeDescription(GeometryType.Polyline, map.SpatialReference); var fieldDescriptions = new[] { new FieldDescription(m_FromVertexToVertex, FieldType.String){Length = 50}, new FieldDescription(m_EdgeLength, FieldType.Double) { Scale = 2, Precision = 9, AliasName = ReportsManagerResources.ReportsManagerProxy_BuildEdgesLayer_DistancesAlias }, }; var featureClassDescription = new FeatureClassDescription(m_ParcelEdgesLayerName, fieldDescriptions, shapeDescription); var schemaBuilder = new SchemaBuilder(geodatabase); schemaBuilder.Create(featureClassDescription); var success = schemaBuilder.Build(); }

 image.png

 

Would love to hear your feedback

Mon, 28 Jun 2021 08:41:18 GMT //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1073112#M6808 dkuida 2021-06-28T08:41:18Z
Re: Create a double field using the DDL //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1073236#M6810

Thanks for reporting this, an ArcGIS Pro Geodatabase team member was able to duplicate this problem when using a memory Geodatabase.  The issue will be fixed in an upcoming Pro release.

Mon, 28 Jun 2021 15:51:55 GMT //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1073236#M6810 Wolf 2021-06-28T15:51:55Z