hsiddique

How do I remove the first 15 characters in a field?

Discussion created by hsiddique on Jul 25, 2011
Latest reply on Jul 25, 2011 by bruce.nielsen
Hi all,

Can someone advise me on how to remove the first 15 characters in a field

I have the following code
# Import system modules
import sys, string, os, arcgisscripting
# Create the Geoprocessor object
gp = arcgisscripting.create(9.3)
# Overwrite data
gp.OverwriteOutput = 1
# Allow fields not to be appended
gp.qualifiedFieldNames = "false"
# Local variables...
inputView = "Database Connections\\UNIFORM BIZTALK.sde\\UNI72LIVE.LLPG"
inputPoint = "Database Connections\\UNISDE on singapore 5155.sde\\UNISDELIVE.UFRM_BLPU_POINT"
featurePoint = "UFRM_BLPU_POINT_Layer"
llpgView = "GIS_LLPG_SOURCE_View"
SDELayer = "Database Connections\\CORPDATA.sde\\ESRIGIS.CORPDATA.BLPU_Property_Points_NEW"
try:
    # Process: Make Feature Layer...
    gp.MakeFeatureLayer_management(inputPoint, featurePoint, "", "", "KEYVAL KEYVAL VISIBLE NONE;UPRN UPRN VISIBLE NONE;CREATEDBY CREATEDBY VISIBLE NONE;MODIFIEDBY MODIFIEDBY VISIBLE NONE;DATE_CREATED DATE_CREATED VISIBLE NONE;DATE_MODIFIED DATE_MODIFIED VISIBLE NONE;STATUS STATUS VISIBLE NONE;TRANSACTION_TYPE TRANSACTION_TYPE VISIBLE NONE;SYMBOL SYMBOL VISIBLE NONE;X X VISIBLE NONE;Y Y VISIBLE NONE;LOGICAL_STATUS LOGICAL_STATUS VISIBLE NONE;ACCURACY ACCURACY VISIBLE NONE;ADDRESS ADDRESS VISIBLE NONE")
    print "1 - Make BLPU points into a View - Complete"
    
    # Process: Make Table View...
    gp.MakeTableView_management(inputView, llpgView, "", "", "S_NAME S_NAME VISIBLE NONE;LOCALITY_NAME LOCALITY_NAME VISIBLE NONE;TOWN_NAME TOWN_NAME VISIBLE NONE;COUNTY_NAME COUNTY_NAME VISIBLE NONE;START_NO START_NO VISIBLE NONE;START_SFX START_SFX VISIBLE NONE;END_NO END_NO VISIBLE NONE;END_SFX END_SFX VISIBLE NONE;DESCRPT DESCRPT VISIBLE NONE;SO_START_NO SO_START_NO VISIBLE NONE;SO_START_SFX SO_START_SFX VISIBLE NONE;SO_END_NO SO_END_NO VISIBLE NONE;SO_END_SFX SO_END_SFX VISIBLE NONE;SO_DESCRPT SO_DESCRPT VISIBLE NONE;POSTCODE POSTCODE VISIBLE NONE;POST_TOWN POST_TOWN VISIBLE NONE;ORGANISATION ORGANISATION VISIBLE NONE;UPDATED_D UPDATED_D VISIBLE NONE;BLPU_CLASS BLPU_CLASS VISIBLE NONE;BLPU_CLASS_DESC BLPU_CLASS_DESC VISIBLE NONE;LOGICAL_STATUS LOGICAL_STATUS VISIBLE NONE;UPRN UPRN VISIBLE NONE")
    print "2 - Make LLPG into a View - Complete"
    
    # Process: Add Join...
    gp.AddJoin_management(featurePoint, "UPRN", llpgView, "UPRN", "KEEP_COMMON")
    print "3 - Join Points to table - Complete"
    
    # Process: Delete Features...
    gp.DeleteFeatures_management(SDELayer)
    print "4 - Delete the features in the SDE later - Complete"
 
    # Process: Append...
    gp.Append_management(featurePoint, SDELayer, "TEST", "", "")
    print "5 - Append the updated BLPU to SDE layer - Complete"
    
    print "Done"
except:
    print "Error has occured"
    print gp.getmessages()
 


When the Add Join occurs, it calls the field UNI72LIVE_LLPG_BLPU_CLASS_DESC I just want the field to be called BLPU_CLASS_DESC, and i want this to occur for all the fields that have "UNI72LIVE_LLPG_" as part of the field name.

Anyone got any idea on how to do this?

Cheers

halil

Outcomes