AnsweredAssumed Answered

Renaming SDE breaks the path of Saved MXD

Question asked by jayprakashkumar706 on Aug 6, 2018

Hello All,

I have created a python add-in. This tool abandons the selected feature(s) to it's abandoning feature class. I read the path of the layer and create the path of the abanond layer in the following way.

 

mxd = arcpy.mapping.MapDocumnet("CURRENT") # Working on Current Map

lyr = arcpy.mapping.ListLayers(mxd)[0] # Reading the first layer object 

lyr_src = lyr.dataSource # Getting the path of the layer

abandon_layer = lyr_src+"\AbandonLayer"  # AbandonLayer path since, Abandon layer stays in same feature dataset in my situation.

 

Now, Whenever I rename the SDE(database connection) in ArcCatalog I am not getting the updated path of SDE.

Note: lyr_src variable still shows the old path only. Hence, I am not getting my feature class to perform the operation. Even though I am refreshing ArcMap, ArcCatalog, Active view it's not helping me.

Conclusion: I know that path is breaking

 

Please, give me an idea. How to handle this situation automatically.

 

Thank you for your time

Jay

Outcomes