Has anyone had any success of repairing disconnected layers that have selection sets that have their data sources broken in ArcGIS? Is there a way to detect this through code and then re-create that selection set?

I tried:




of which just give an "Object reference not set to an instance of an object" error.

We are on version 10.0 and code in VB.NET or C#.

  • do you mean repairing layers which have data sources broken? – vinayan May 18 '12 at 15:06
  • yes - layers that have data sources broken – Rob May 19 '12 at 15:39
  • Did you check the ILayer.Valid property? – blah238 May 21 '12 at 9:33
  • Blah238 - someone annoyingly edited my question and removed the specifics of what I was asking. ILayer.Valid will tell you if the layer is not valid but of course it won't tell you if the layer had a selection set before it become disconnected. I'm specifically talking about selection sets. – Rob May 21 '12 at 19:53
  • 1
    @blah238: The OID list does get persisted in the map document, you just can't access it once the layer is not connected. I also believe that on SDE, large (> 200 rows) selection sets get persisted to the database. Not sure they are saved in the MXD in that case as well. – Petr Krebs May 22 '12 at 15:05

Seems to be no answer for this except to try to repath before you move data. Then before changing the path record the oids of the selection set and I've re-applied as a definition query instead or create a new layer with a selection set.

| improve this answer | |

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.