AnsweredAssumed Answered

Rename or export the result of an AddJoin

Question asked by nigel_ngl2 on Dec 8, 2015
Latest reply on Dec 9, 2015 by nigel_ngl2

Hi, I have featureclass and a table who's data i wish to join. I am using the AddJoin class to perform this operation. However after the join i get a layer like "GPL0" in the TOC with the results. Why hasn't the join got applied to the featureclass? If I run the AddJoin tool manualy from the toolbox in ArcMap the result appears in the featureclass table. But the same does not display when I try to achieve it programatically. Is it possible to rename or export GPL0?

Here is my snippet.

 ITable pDerivedTable = OuputFGBLocation.OpenTable(tablename);
                       //ITableView pJoinTableView = new TableViewClass();
                       //pJoinTableView.Table = pDerivedTable;


                       //GDM Layer
                      ITable pGDMFClassTable = pGDMFclass as ITable;
                      //ITableView pGDMTableView = new TableViewClass();
                      //pGDMTableView.Table = pGDMFClassTable;
                


                       AddJoin pAddJoin = new AddJoin();
                       pAddJoin.in_layer_or_view = pGDMFClassTable;
                       pAddJoin.in_field = pGDMFClassTable.Fields.get_Field(pGDMFClassTable.Fields.FindField(AddInObjects.GDMID_FIELD_NAME));
                       pAddJoin.join_table = pDerivedTable;
                       pAddJoin.join_field = pDerivedTable.Fields.get_Field(pDerivedTable.Fields.FindField("ORIGGDMID"));                       
                       pAddJoin.join_type = "KEEP_COMMON";
                       pGp.Execute(pAddJoin,null);
                     

Regards,

Nigel.

Outcomes