<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to Set Data Source of a Layer In an MXD From SDE connection in Python Snippets Questions</title>
    <link>https://community.esri.com/t5/python-snippets-questions/how-to-set-data-source-of-a-layer-in-an-mxd-from/m-p/808887#M289</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;A _jive_internal="true" class="" data-userid="230847" data-username="asrujit_pb" href="https://community.esri.com/people/asrujit_pb" style="color: #3778c7; background-color: #ffffff; border: 0px; font-weight: 200; text-decoration: underline; font-size: 1.286rem;"&gt;Asrujit SenGupta&lt;/A&gt;&lt;/P&gt;&lt;P&gt;but still getting same error&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Aug 2017 06:04:39 GMT</pubDate>
    <dc:creator>BehrouzHosseini</dc:creator>
    <dc:date>2017-08-29T06:04:39Z</dc:date>
    <item>
      <title>How to Set Data Source of a Layer In an MXD From SDE connection</title>
      <link>https://community.esri.com/t5/python-snippets-questions/how-to-set-data-source-of-a-layer-in-an-mxd-from/m-p/808885#M287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you please take a look at this example and let me know how to I can &lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt;replace Data Source&amp;nbsp;&lt;/SPAN&gt;data of a layer in a saved mxd map (Fuse) to a layer called&amp;nbsp;SDEElectric.DBO.Fuse which is in an enterprise geodatabase through database&amp;nbsp;connection&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried this code but it didnt work&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
mxd &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MapDocument&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"C:\GIS\Maps\Electric.mxd"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
src &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"C:\Users\xxx\AppData\Roaming\ESRI\Desktop10.4\ArcCatalog\SDEElectric.sde\SDEElectric.DBO.Dataset\SDEElectric.DBO.Fuse"&lt;/SPAN&gt;
df &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListDataFrames&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mxd&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; lyr &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListLayers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mxd&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; df&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
 &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Fuse"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
 lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replaceDataSource&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;src&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"FILEGDB_WORKSPACE"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
mxd&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;save&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;del&lt;/SPAN&gt; mxd
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"done"&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:28:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/how-to-set-data-source-of-a-layer-in-an-mxd-from/m-p/808885#M287</guid>
      <dc:creator>BehrouzHosseini</dc:creator>
      <dc:date>2021-12-12T09:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set Data Source of a Layer In an MXD From SDE connection</title>
      <link>https://community.esri.com/t5/python-snippets-questions/how-to-set-data-source-of-a-layer-in-an-mxd-from/m-p/808886#M288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not a Python expert, but&amp;nbsp;&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replaceDataSource&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;src&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"FILEGDB_WORKSPACE"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Shouldn't the above reflect an Enterprise gdb, like below:&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replaceDataSource&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;src&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"SDE_WORKSPACE"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the above doesn't help, share the errors you receive and that may also help someone to provide an answer....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Aug 2017 05:51:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/how-to-set-data-source-of-a-layer-in-an-mxd-from/m-p/808886#M288</guid>
      <dc:creator>Asrujit_SenGupta</dc:creator>
      <dc:date>2017-08-29T05:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set Data Source of a Layer In an MXD From SDE connection</title>
      <link>https://community.esri.com/t5/python-snippets-questions/how-to-set-data-source-of-a-layer-in-an-mxd-from/m-p/808887#M289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;A _jive_internal="true" class="" data-userid="230847" data-username="asrujit_pb" href="https://community.esri.com/people/asrujit_pb" style="color: #3778c7; background-color: #ffffff; border: 0px; font-weight: 200; text-decoration: underline; font-size: 1.286rem;"&gt;Asrujit SenGupta&lt;/A&gt;&lt;/P&gt;&lt;P&gt;but still getting same error&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Aug 2017 06:04:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/how-to-set-data-source-of-a-layer-in-an-mxd-from/m-p/808887#M289</guid>
      <dc:creator>BehrouzHosseini</dc:creator>
      <dc:date>2017-08-29T06:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set Data Source of a Layer In an MXD From SDE connection</title>
      <link>https://community.esri.com/t5/python-snippets-questions/how-to-set-data-source-of-a-layer-in-an-mxd-from/m-p/808888#M290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What errors do you receive?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Aug 2017 06:17:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/how-to-set-data-source-of-a-layer-in-an-mxd-from/m-p/808888#M290</guid>
      <dc:creator>Asrujit_SenGupta</dc:creator>
      <dc:date>2017-08-29T06:17:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set Data Source of a Layer In an MXD From SDE connection</title>
      <link>https://community.esri.com/t5/python-snippets-questions/how-to-set-data-source-of-a-layer-in-an-mxd-from/m-p/808889#M291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you may want to look at &lt;A href="https://community.esri.com/blogs/myAlaskaGIS/2015/08/31/python-addin-for-data-inventory-and-broken-link-repair?sr=search&amp;amp;searchId=4a7b91b5-3f90-419f-b392-6b2547e79261&amp;amp;searchIndex=6"&gt;/blogs/myAlaskaGIS/2015/08/31/python-addin-for-data-inventory-and-broken-link-repair?sr=search&amp;amp;searchId=4a7b91b5-3f90-419f-b392-6b2547e79261&amp;amp;searchIndex=6&lt;/A&gt;‌ to see samples of how I view and replace sources in mxd.&amp;nbsp; It's based mainly on broken-links, so may not work for you, but just in case.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Aug 2017 15:16:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/how-to-set-data-source-of-a-layer-in-an-mxd-from/m-p/808889#M291</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2017-08-29T15:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set Data Source of a Layer In an MXD From SDE connection</title>
      <link>https://community.esri.com/t5/python-snippets-questions/how-to-set-data-source-of-a-layer-in-an-mxd-from/m-p/808890#M292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Rebecca, I already spend some time there but it was not really helpful as it mainly focus was on fixing broken links&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Aug 2017 15:20:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/how-to-set-data-source-of-a-layer-in-an-mxd-from/m-p/808890#M292</guid>
      <dc:creator>BehrouzHosseini</dc:creator>
      <dc:date>2017-08-29T15:20:39Z</dc:date>
    </item>
  </channel>
</rss>

