AnsweredAssumed Answered

Feature's HasOID is false, values are empty

Question asked by stefda on Jun 2, 2015
Latest reply on Jul 7, 2015 by tedrakel

I'm trying to get a value of a particular field from selected features. The features are from a layer that contains data from a file geodatabase. The data has been imported from an excel spreasheet, the file geodatabase is set as the default geodatabase and the feature class appears to be registered with it (the "Register with Geodatabase" option in the Manage menu is disabled).


I obtain IEnumFeature from the focused map's FeatureSelection:


IMap map = ArcMap.Document.ActiveView.FocusMap;
IEnumFeature ftEnum = map.FeatureSelection as IEnumFeature;


I then have a while loop that fetches selected features from the enum and tries to get a particular field value:


IFeature ft = null;

while ((ft = ftEnum.Next()) != null) {
    int fid = ft.Fields.FindField("LOCODE");
    string locode = ft.get_Value(fid) as string;


Now, the fid gets correctly assigned to 1, which is the index of the "LOCODE" field, but the returned value is null. I noticed that the features do not have OID associated with them. Why is that? If I export the feature class as a shapefile and add it to the map, the OIDs are set. But the "LOCODE" values are missing in either case.


Why is this happening?