<?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 calculate field on sde versioned data in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/calculate-field-on-sde-versioned-data/m-p/327121#M25414</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;I need to do some update an attribute on a SDE feature class (versioned).&lt;/P&gt;&lt;P&gt;The feature class is within a FeatureDataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to do a simple calculate field on a specific version of my data (the user will chose the version).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But It fail every time.&amp;nbsp; I can do this on the DEFAULT version only.&lt;/P&gt;&lt;P&gt;I try something like this&lt;/P&gt;&lt;P&gt;edit = arcpy.da.Editor(workspace)&lt;BR /&gt;edit.startEditing(False, True)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#Creating a feature layer (no selection, all the data)&lt;/P&gt;&lt;P&gt;arcpy.MakeFeatureLayer_management(fc,_mon_feature_layer)&lt;/P&gt;&lt;P&gt;#Changing the version&lt;BR /&gt;arcpy.ChangeVersion_management(_mon_feature_layer, 'TRANSACTIONAL', _ma_version_cible)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any Idea?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 Nov 2017 16:02:55 GMT</pubDate>
    <dc:creator>FrancisMoisan</dc:creator>
    <dc:date>2017-11-02T16:02:55Z</dc:date>
    <item>
      <title>calculate field on sde versioned data</title>
      <link>https://community.esri.com/t5/python-questions/calculate-field-on-sde-versioned-data/m-p/327121#M25414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;I need to do some update an attribute on a SDE feature class (versioned).&lt;/P&gt;&lt;P&gt;The feature class is within a FeatureDataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to do a simple calculate field on a specific version of my data (the user will chose the version).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But It fail every time.&amp;nbsp; I can do this on the DEFAULT version only.&lt;/P&gt;&lt;P&gt;I try something like this&lt;/P&gt;&lt;P&gt;edit = arcpy.da.Editor(workspace)&lt;BR /&gt;edit.startEditing(False, True)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#Creating a feature layer (no selection, all the data)&lt;/P&gt;&lt;P&gt;arcpy.MakeFeatureLayer_management(fc,_mon_feature_layer)&lt;/P&gt;&lt;P&gt;#Changing the version&lt;BR /&gt;arcpy.ChangeVersion_management(_mon_feature_layer, 'TRANSACTIONAL', _ma_version_cible)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any Idea?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Nov 2017 16:02:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-field-on-sde-versioned-data/m-p/327121#M25414</guid>
      <dc:creator>FrancisMoisan</dc:creator>
      <dc:date>2017-11-02T16:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: calculate field on sde versioned data</title>
      <link>https://community.esri.com/t5/python-questions/calculate-field-on-sde-versioned-data/m-p/327122#M25415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Francis,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all, what is the error you are getting when running this script?&lt;/P&gt;&lt;P&gt;A troubleshooting tip would be to add a print statement after the MakeFeatureLayer line.&amp;nbsp; Seeing the print statement "MakeFeatureLayer complete"&amp;nbsp;ensures us that the layer is successfully being created, and that the failure is definitely occurring during ChangeVersion statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just from reviewing the syntax provided:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;The ChangeVersion_Management syntax actually has 4 parameters.&amp;nbsp; Also, don't forget single quotes, and fully qualified names:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;ChangeVersion_management (in_features, version_type, {version_name}, {date})

&lt;/PRE&gt;&lt;P&gt;arcpy.ChangeVersion_management(&lt;STRONG&gt;'&lt;/STRONG&gt;_mon_feature_layer&lt;STRONG&gt;'&lt;/STRONG&gt;,'TRANSACTIONAL', &lt;STRONG&gt;'&amp;lt;schema&amp;gt;.&lt;/STRONG&gt;_ma_version_cible&lt;STRONG&gt;',''&lt;/STRONG&gt;)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:30:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-field-on-sde-versioned-data/m-p/327122#M25415</guid>
      <dc:creator>TinaMorgan1</dc:creator>
      <dc:date>2021-12-11T15:30:23Z</dc:date>
    </item>
  </channel>
</rss>

