Select to view content in your preferred language

Subtype not getting set on new feature using makeFeature

720
2
Jump to solution
03-29-2023 01:42 PM
DuanePfeiffer
Regular Contributor

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
Deactivated User

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
Deactivated User

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
Regular Contributor

Needed to add Int32(1).  Thanks

0 Kudos