Subtype not getting set on new feature using makeFeature

462
2
Jump to solution
03-29-2023 01:42 PM
DuanePfeiffer
New Contributor III

I'm creating a new feature using a dictionary of attributes.  However, the subtype doesn't appear to be getting set.  Am I doing this correctly?

                // LOAD ATTRIBUTES
                appData.markUpAttributes.updateValue(1, forKey: "SubtypeCode")
                let servicePointNumber = appData.targetFeature.attributes["gs_service_number"] as? String ?? ""
                appData.markUpAttributes.updateValue("Move SP#\(servicePointNumber) to here.", forKey: "Comment")
                appData.markUpAttributes.updateValue(Date(), forKey: "DateDrawn")
                // ADD LINE
                appData.polylineBuilder.add(appData.targetFeature!.geometry as! Point)
                appData.polylineBuilder.add(mapPoint)
                let line = appData.polylineBuilder.toGeometry()
                let lineFeature = appData.mapLineTable.makeFeature(attributes: appData.markUpAttributes as [String : Any], geometry: line)
                try await self.AddFeatureToMapLineTable(newFeature: lineFeature)
0 Kudos
1 Solution

Accepted Solutions
rolson_esri
New Contributor III

What is the exact field type for `SubtypeCode`?  For example, is it int32 or int64?

If it is int32, you might need to do this:

appData.markUpAttributes.updateValue(Int32(1), forKey: "SubtypeCode")

 

And if it is int64, this:

appData.markUpAttributes.updateValue(Int64(1), forKey: "SubtypeCode")

 

The literal value of  `1` in Swift is an `Int` in your code.  Because features are strongly typed, we need to make sure we are passing the exact integer type to attributes.

View solution in original post

2 Replies
rolson_esri
New Contributor III

What is the exact field type for `SubtypeCode`?  For example, is it int32 or int64?

If it is int32, you might need to do this:

appData.markUpAttributes.updateValue(Int32(1), forKey: "SubtypeCode")

 

And if it is int64, this:

appData.markUpAttributes.updateValue(Int64(1), forKey: "SubtypeCode")

 

The literal value of  `1` in Swift is an `Int` in your code.  Because features are strongly typed, we need to make sure we are passing the exact integer type to attributes.

DuanePfeiffer
New Contributor III

Needed to add Int32(1).  Thanks

0 Kudos