How to convert IFields to Fields

 

I am trying connect to external database (simple standalone DBF) to one of layer dynamically using ADF. I wrote a method to connect to database and return the fields. I can able to join with database but retrieving fields seems bit tough!. The RelQueryTable class has method  getFields() which returns  IFields objects . How to convert to IFields to Fields object in com.esri.arcgisws which has getFieldArray() to obtain fields list.

 

Can anyone ping me or give me any clues? 

 

private Fields JoinTable(IServerContext pSC, IFeatureClass pFeatclass){

try{                

ShapefileWorkspaceFactory filefactory = (ShapefileWorkspaceFactory)pSC.createObject(ShapefileWorkspaceFactory.getClsid());

Workspace ws = (Workspace) filefactory.openFromFile(“C:/test/”, 0);

IRelationshipClass pRelationshipClass ;              

ITable table = ws.openTable(“1Z.dbf”);

factory = (MemoryRelationshipClassFactory)pSC.createObject(MemoryRelationshipClassFactory.getClsid());

MemoryRelationshipClass rclass = (MemoryRelationshipClass)factory.open(“test”, pFeatclass, “ZONENO”, new ObjectClass(table),”ZONENO”, “forward”, “backward”, esriRelCardinality.esriRelCardinalityOneToOne);                     

RelQueryTableFactory relQueryTableFact = (RelQueryTableFactory)pSC.createObject(RelQueryTableFactory.getClsid());

RelQueryTable relQueryTab = (RelQueryTable) relQueryTableFact.open (rclass, true, null, null, “”, true, true);

System.out.println(“After Joining total Field count::::::”+ relQueryTab.getFields().getFieldCount())                        

return  relQueryTab.getFields();        

 }

catch(Exception ex){

System.out.println(“ERROR in JOINTable Method”+ ex.toString());

return null;

}

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: