1

Trying to remove the joins between two feature layers gets me this result after running each line individually through the interpreter:

MakeFeatureLayer("Y:/Desktop/Data/Levels_copy.shp","tempLevels")
<Result 'tempLevels'>
MakeFeatureLayer("Y:/Desktop/Data/Points_copy.shp","tempPoints" )
<Result 'tempPoints'>
AddJoin("tempPoints", "LEVEL_ID", "tempLevels", "LEVEL_ID")
<Result 'tempPoints'>
RemoveJoin("tempPoints", "tempLevels")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\management.py", line 6161, in RemoveJoin
        raise e
    ExecuteError: Failed to execute. Parameters are not valid.
    ERROR 000800: The value is not a member of  | Levels_copy.
    Failed to execute (RemoveJoin).

Am I missing something? Do the feature layers not exist in memory by the time I try to remove the joins?

Update

The joins still seem to exist as this codeblock still gives me fields from both shapefiles:

desc = arcpy.Describe("tempPoints").fields
for f in desc:
    print f.name
0

After investigating it more thoroughly, the proper remove join would have been:RemoveJoin("tempPoints", "Levels_copy")

From esri's own documentation:

If the join table was a dBASE file named MyTable.dbf, the join name would be "MyTable"; so to remove it, specify "MyTable".

A small detail, but one that can easily be overlooked since the feature layers are not technically independent objects.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.