Does your text file contain the same column headings? If it does it will rename them that way.Why do it with code. Simply perform a join manually. it will probably not happen.
After the following code is run the attribute table on the shape file to which a comma delimited text file was joined contains the field names as listed on the first line of the text file. In the exported shape file of the joined feature class and table, the field names from the joined text file now appear as qryResults,qryResul_1, qryResul_2, qryResul_3, qryResul_4 instead of the field names in the table of ACTNUM, MA_,SA_,NH_, and PIN. This worked fine in 10.0 and now in 10.1 the next function following the export that uses the field names fails. Is this the result that should be expected from this join in 101?Thanks........Scott Dim bolJoin As Boolean bolJoin = JoinTableToLayer(pGFLayer, pRTable, "PIN", "PIN") pFClass = pGFLayer.DisplayFeatureClass exportFC(pFClass, "taxlots_2") 'pFLayer = New FeatureLayer 'pFClass = pFWorkspace.OpenFeatureClass("taxlots_2") 'pFLayer.FeatureClass = pFClass 'pFLayer.Name = "taxlots_2" 'pMap.AddLayer(pFLayer) 'pMxDoc.UpdateContents() '**************************** End Sub Public Function JoinTableToLayer(ByVal pFeatureLayer As IGeoFeatureLayer, _ ByVal pTable As ITable, _ ByVal sLayerField As String, _ ByVal sTableField As String) As Boolean Dim pMemoryRelationshipClassFactory As IMemoryRelationshipClassFactory Dim pRelationshipClass As IRelationshipClass Dim pDisplayRelationshipClass As IDisplayRelationshipClass 'On Error GoTo ErrorHandler 'pMemoryRelationshipClassFactory = New MemoryRelationshipClassFactory pMemoryRelationshipClassFactory = New MemoryRelationshipClassFactoryClass() pRelationshipClass = pMemoryRelationshipClassFactory.Open("Join", pFeatureLayer.DisplayFeatureClass, sLayerField, pTable, sTableField, "forward", "backward", esriRelCardinality.esriRelCardinalityOneToOne) pDisplayRelationshipClass = pFeatureLayer On Error GoTo ErrorHandler pDisplayRelationshipClass.DisplayRelationshipClass(pRelationshipClass, esriJoinType.esriLeftOuterJoin) JoinTableToLayer = True Exit FunctionErrorHandler: 'ErrorMessage "modGlobals:JoinTableToLayer()" End Function
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.