hsiddique

gp.QualifiedFieldNames = "UNQUALIFIED" is not working

Discussion created by hsiddique on Jul 21, 2011
Latest reply on Nov 15, 2012 by curtvprice
Hi all,

I have the following script, but for some reason in my shapefile (Step 5) , its does not keep the field name for the Joined fields.

# Name: BLPU_VIEW.py
# Author: Halil Siddique
# Description: This scripts will  Join the BLPU Point layer and the GIS_LLPG_SOURCE view.
# Date: 21/07/2011

# Create the Geoprocessor object
import arcgisscripting
gp = arcgisscripting.create(9.3)

# Allow Overwrite
gp.OverwriteOutput = 1

# Set Workspace
gp.Workspace = "C:\\datadump"
datadump = gp.Workspace

# Input variables from SDE
inputPoint = "C:\\TestData on CORPGIS.sde\\TESTDATA.BLPU_POINT"
inputView = "C:\\TestData on CORPGIS.sde\\TESTDATA.GIS_LLPG_SOURCE"
BLPU_TEST = "C:\\TestData on CORPGIS.sde\\TESTDATA.BLPU_TEST"

# Input variables from datadump folder

# Allow Unqualified field names
gp.QualifiedFieldNames = "UNQUALIFIED"

#####################################################################

try:

    
    # Create Feature Layer from BLPU point
    gp.makeFeatureLayer_management(inputPoint, "point_lyr")
    print "1 - ", inputPoint, "is now a feature layer"

    # Export GIS_LLPG_SOURCE to datadump to get OID
    gp.copyrows_management(inputView, "GIS_LLPG_SOURCEExport")
    print "2 - ", "inputView", "has been exported to", datadump

    # Create Table View from GIS_LLPG_SOURCE
    gp.makeTableView_management("GIS_LLPG_SOURCEExport", "GIS_LLPG_SOURCEView")   
    print "3 - GIS_LLPG_SOURCE is now a table view"

     # Join BLPU_POINT layer  with GIS_LLPG_SOURCE
    gp.AddJoin_management("point_lyr", "UPRN", "GIS_LLPG_SOURCEView", "UPRN")
    print "4 - ", "Points has been joined to GIS_LLPG_SOURCE"

    
    # Export Joined Point layer
    gp.copyFeatures_management("point_lyr", "READY_FOR_SDE")
    print "5 - ", "Joined points has been exported to", datadump

    # Delete features from SDE layer
    gp.deletefeatures(BLPU_TEST)
    print "6 - ", "BLPU_TEST features deleted"

    # Upload new BLPU points
    gp.append_management("C:\\datadump\\READY_FOR_SDE.SHP", BLPU_TEST, "NO_TEST","")
    print "7 - ", "new BLPU points uploaded"
    
except:
    print "Error has occured"
    print gp.getmessages()




My field names end up becoming

  GIS_LLPG_S   GIS_LLPG_1   GIS_LLPG_2   GIS_LLPG_3   GIS_LLPG_4   GIS_LLPG_5   GIS_LLPG_6   GIS_LLPG_7   GIS_LLPG_8   GIS_LLPG_9   GIS_LLP_10   GIS_LLP_11   GIS_LLP_12   GIS_LLP_13   GIS_LLP_14   GIS_LLP_15   GIS_LLP_16
Anyone got any ideas or workarounds?

Cheers
halil

Outcomes