Update Data Source resetting Field properties on layers with joins

Discussion created by cbseagle-co-nz-esridist Employee on Sep 12, 2012

I am writing a python script to change datasources when a set of mxd's are migrated through environments i.e. Dev -> Test -> Prod. A cumbersome task if done manually but should be pretty simple with the arcpy.mapping module - or at least I thought so!!

My main issue is around the field properties (visibility and appearance) of layers that have a join. Whenever the datasource is updated the field properties are set back default. i.e. Everything on which is not what I want. Layers that do not have a join are OK.

NOTE: Even when you update the datasource within ArcMap itself on a layer with a join it resets the field properties. This implies that there is a issue with the underlying software itself??

I have tried everything I can think of to try and work around this issue including.

1. All the methods to update the datsource

2. Removing the join before updating the datasource but removing the join actually resets the field properties as well!! I had intended to reapply the join after updating the datasource.

3. Describing the Layer object to get the fieldmap properties. Fails in 10 which is the environment I am working in currently but works in 10.1 I cant see any way however of reapplying that fieldmap object to the Layer after updating the datasource anyway?

I would be interested if anybody had any thoughts on this and especially interested if anybody has managed to find a solution to this issue.

Thank You

Callum Smith