AnsweredAssumed Answered

Get feature value for the selected feature - Java

Question asked by najed on Aug 16, 2014
Latest reply on Aug 17, 2014 by oearley

Dear All

 

I am working now to develop application by using Arcgis Engine 10.1 / Arcobject (Java) , i have connect to personal Geodabase (Mdb)  and i retrieve fields name layer name , fields properties (Geometry , type...) but when i try to retrieve information for the values (attribute value) i got null value .... i need your help to get the value in the fields ?

 

for example if i have (USA.mdb) personal geodatabase , layer name is : country , (fields : county name , country name , area) ....

 

what i need exactly to retrieve the county value from the county field  (California , Colorado... ...)

 

the below the code what i use it ....

 

and what is the different if i read the feature through (MXD file) or direct connect to MDB (personal Geo-database) the code will change or what i need you clarification please ....

 

Thanks

 

IFeatureClass featureClass = featureLayer.getFeatureClass();

System.out.println(">>>+>>>>>"+featureClass.getAliasName());

 

// System.out.println(">>>+>>>>>"+featureClass.getFeatureClassID());

// System.out.println(">>>+>>>>>"+featureClass.getFeatureType());

 

IFields fields = featureClass.getFields();

System.out.print("+++++++++count  " +fields.getFieldCount());

// for (int i =0 ; i< fields.getFieldCount() ;i++){

// System.out.println(fields.getField(i).getName() + " - " + fields.getField(i).getDefaultValue());

// }

//

 

for (int index = 0; index < fields.getFieldCount(); index++) {

//Get the field at the specified index

Field field = (Field) fields.getField(index);

 

if (field == null) {

System.out.println("Field is null ");

continue;

}

 

//Print out some metadata information

System.out.println("\tPhysical Name : " + field.getName());

System.out.println("\tAlias Name    : " + field.getAliasName());

System.out.println("\tType          : " + getFieldTypeDescription(field.getType()));

System.out.println("\tLength        : " + field.getLength());

System.out.println("\tPrecision     : " + field.getPrecision());

System.out.println("\tEditable      : " + field.isEditable());

 

//Default Value

Object defaultValue = field.getDefaultValue();

if (defaultValue == null) {

System.out.println("\tDefault Value : <Unspecified>");

}

else {

System.out.println("\tDefault Value : " + defaultValue);

}

 

System.out.println();

}

Outcomes