<?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 Problem using scripts to calculate fields in ArcPro Fabric Branched Versioning 3.0+ in ArcGIS Parcel Fabric Questions</title>
    <link>https://community.esri.com/t5/arcgis-parcel-fabric-questions/problem-using-scripts-to-calculate-fields-in/m-p/1231090#M874</link>
    <description>&lt;P&gt;We use a lot of tools/scripts to calculate values within the ArcPro/Parcel Fabric Branched Version Environment (when it makes sense not to use tasks or calc attribute rules).&amp;nbsp; &amp;nbsp;I am testing Version 3.0+ and have run into the following problem and am hoping that I may doing something wrong.&amp;nbsp; After a lot of testing I have created the following simple script that that illustrates the problem. (This all works fine in 2.94 and in a standard GeoDatabase). We do not use SDE for editing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Start State: Within Branched Version (GISADMIN.T67_9c_Test200Anno4) , Anno0200Scale feature class with Field (MapNumber) with value set to '6.3.8C').&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proposed Process: Select&amp;nbsp;OBJECTID = 7695 and Calc the value for MapNumber to be "XXXX" .&amp;nbsp; I have tested this using arcpy.da.Editor using UpdateCursor with the Source being:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://giscarts.co.polk.or.us/server/rest/services/PF/Parcel_Fabric_3/FeatureServer;VERSION=GISADMIN.T67_9c_Test200Anno4;VERSIONGUID={6284F53F-3A4B-4FFF-994E-7606A6AA3783}" target="_blank"&gt;https://giscarts.co.polk.or.us/server/rest/services/PF/Parcel_Fabric_3/FeatureServer;VERSION=GISADMIN.T67_9c_Test200Anno4;VERSIONGUID={6284F53F-3A4B-4FFF-994E-7606A6AA3783}&lt;/A&gt;&amp;nbsp; which I calculate from the datasource of the Anno0200Scale feature class (after I removed the feature class name from the datasource text string).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tested this without using the arcpy.da.Editor with da.UpdateCursor.&amp;nbsp; I have also tested this with a simple CalculateField both using the arcpy.da.editor and not using it.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem:&amp;nbsp; I always get the same result.&amp;nbsp; NOTHING HAPPENS unless I close the ArcPro session and reopen it. Then I can see the change.&amp;nbsp; Using refresh screen / Change Version tool etc... None of it works.&amp;nbsp; Its like the edit did not happen until I close the session and then go back in.&amp;nbsp; My hope is that I am doing something wrong and somebody can help me out.&amp;nbsp; Below is the script (again this is not production just a test).&amp;nbsp; - it is also attached as a txt file.&amp;nbsp; Finally, within a simple edit session I can interactively select features and calculate attributes, see the results with no problem.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import arcpy, os&lt;/P&gt;&lt;P&gt;# 1. Get parameter values&lt;/P&gt;&lt;P&gt;AnnoLayer = 'Anno0200Scale'&lt;/P&gt;&lt;P&gt;#2. Set Map Layers and default paths&lt;/P&gt;&lt;P&gt;thisProject = arcpy.mp.ArcGISProject("CURRENT")&lt;BR /&gt;Map = thisProject.activeMap&lt;BR /&gt;AnnoLyr = Map.listLayers(AnnoLayer)[0]&lt;BR /&gt;FolderPath = thisProject.homeFolder&lt;/P&gt;&lt;P&gt;arcpy.AddMessage ("Map: " + Map.name)&lt;BR /&gt;arcpy.AddMessage (AnnoLyr.dataSource)&lt;/P&gt;&lt;P&gt;datasource = AnnoLyr.dataSource&lt;BR /&gt;lastslash = datasource.rfind("/")&lt;BR /&gt;workspace = datasource[:lastslash]&lt;/P&gt;&lt;P&gt;arcpy.AddMessage(workspace)&lt;/P&gt;&lt;P&gt;MapNumber = 'XXXX'&lt;/P&gt;&lt;P&gt;# do edit session (Comment it out if you do not want to use it&lt;/P&gt;&lt;P&gt;edit = arcpy.da.Editor(workspace)&lt;BR /&gt;edit.startEditing(with_undo=False, multiuser_mode=True)&lt;BR /&gt;edit.startOperation()&lt;/P&gt;&lt;P&gt;with arcpy.da.UpdateCursor(AnnoLyr, ["MapNumber"],"OBJECTID = 7695") as cursor:&lt;BR /&gt;for row in cursor:&lt;BR /&gt;row[0] = MapNumber&lt;BR /&gt;cursor.updateRow(row)&lt;/P&gt;&lt;P&gt;edit.stopOperation()&lt;BR /&gt;edit.stopEditing(save_changes=True)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 13 Nov 2022 20:47:29 GMT</pubDate>
    <dc:creator>DeanAnderson2</dc:creator>
    <dc:date>2022-11-13T20:47:29Z</dc:date>
    <item>
      <title>Problem using scripts to calculate fields in ArcPro Fabric Branched Versioning 3.0+</title>
      <link>https://community.esri.com/t5/arcgis-parcel-fabric-questions/problem-using-scripts-to-calculate-fields-in/m-p/1231090#M874</link>
      <description>&lt;P&gt;We use a lot of tools/scripts to calculate values within the ArcPro/Parcel Fabric Branched Version Environment (when it makes sense not to use tasks or calc attribute rules).&amp;nbsp; &amp;nbsp;I am testing Version 3.0+ and have run into the following problem and am hoping that I may doing something wrong.&amp;nbsp; After a lot of testing I have created the following simple script that that illustrates the problem. (This all works fine in 2.94 and in a standard GeoDatabase). We do not use SDE for editing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Start State: Within Branched Version (GISADMIN.T67_9c_Test200Anno4) , Anno0200Scale feature class with Field (MapNumber) with value set to '6.3.8C').&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proposed Process: Select&amp;nbsp;OBJECTID = 7695 and Calc the value for MapNumber to be "XXXX" .&amp;nbsp; I have tested this using arcpy.da.Editor using UpdateCursor with the Source being:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://giscarts.co.polk.or.us/server/rest/services/PF/Parcel_Fabric_3/FeatureServer;VERSION=GISADMIN.T67_9c_Test200Anno4;VERSIONGUID={6284F53F-3A4B-4FFF-994E-7606A6AA3783}" target="_blank"&gt;https://giscarts.co.polk.or.us/server/rest/services/PF/Parcel_Fabric_3/FeatureServer;VERSION=GISADMIN.T67_9c_Test200Anno4;VERSIONGUID={6284F53F-3A4B-4FFF-994E-7606A6AA3783}&lt;/A&gt;&amp;nbsp; which I calculate from the datasource of the Anno0200Scale feature class (after I removed the feature class name from the datasource text string).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tested this without using the arcpy.da.Editor with da.UpdateCursor.&amp;nbsp; I have also tested this with a simple CalculateField both using the arcpy.da.editor and not using it.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem:&amp;nbsp; I always get the same result.&amp;nbsp; NOTHING HAPPENS unless I close the ArcPro session and reopen it. Then I can see the change.&amp;nbsp; Using refresh screen / Change Version tool etc... None of it works.&amp;nbsp; Its like the edit did not happen until I close the session and then go back in.&amp;nbsp; My hope is that I am doing something wrong and somebody can help me out.&amp;nbsp; Below is the script (again this is not production just a test).&amp;nbsp; - it is also attached as a txt file.&amp;nbsp; Finally, within a simple edit session I can interactively select features and calculate attributes, see the results with no problem.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import arcpy, os&lt;/P&gt;&lt;P&gt;# 1. Get parameter values&lt;/P&gt;&lt;P&gt;AnnoLayer = 'Anno0200Scale'&lt;/P&gt;&lt;P&gt;#2. Set Map Layers and default paths&lt;/P&gt;&lt;P&gt;thisProject = arcpy.mp.ArcGISProject("CURRENT")&lt;BR /&gt;Map = thisProject.activeMap&lt;BR /&gt;AnnoLyr = Map.listLayers(AnnoLayer)[0]&lt;BR /&gt;FolderPath = thisProject.homeFolder&lt;/P&gt;&lt;P&gt;arcpy.AddMessage ("Map: " + Map.name)&lt;BR /&gt;arcpy.AddMessage (AnnoLyr.dataSource)&lt;/P&gt;&lt;P&gt;datasource = AnnoLyr.dataSource&lt;BR /&gt;lastslash = datasource.rfind("/")&lt;BR /&gt;workspace = datasource[:lastslash]&lt;/P&gt;&lt;P&gt;arcpy.AddMessage(workspace)&lt;/P&gt;&lt;P&gt;MapNumber = 'XXXX'&lt;/P&gt;&lt;P&gt;# do edit session (Comment it out if you do not want to use it&lt;/P&gt;&lt;P&gt;edit = arcpy.da.Editor(workspace)&lt;BR /&gt;edit.startEditing(with_undo=False, multiuser_mode=True)&lt;BR /&gt;edit.startOperation()&lt;/P&gt;&lt;P&gt;with arcpy.da.UpdateCursor(AnnoLyr, ["MapNumber"],"OBJECTID = 7695") as cursor:&lt;BR /&gt;for row in cursor:&lt;BR /&gt;row[0] = MapNumber&lt;BR /&gt;cursor.updateRow(row)&lt;/P&gt;&lt;P&gt;edit.stopOperation()&lt;BR /&gt;edit.stopEditing(save_changes=True)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Nov 2022 20:47:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-parcel-fabric-questions/problem-using-scripts-to-calculate-fields-in/m-p/1231090#M874</guid>
      <dc:creator>DeanAnderson2</dc:creator>
      <dc:date>2022-11-13T20:47:29Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using scripts to calculate fields in ArcPro Fabric Branched Versioning 3.0+</title>
      <link>https://community.esri.com/t5/arcgis-parcel-fabric-questions/problem-using-scripts-to-calculate-fields-in/m-p/1231145#M875</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/337997"&gt;@DeanAnderson2&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This looks to me like:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;An ArcGIS Pro refresh issue - the values are getting calculated but it requires closing and opening the ArcGIS Pro client to see the changes.&lt;/LI&gt;&lt;LI&gt;A python issue when working against feature services.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;My Advice:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Since this is not specific to the parcel fabric, move this post to the ArcGIS Pro Questions&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-questions/bd-p/arcgis-pro-questions" target="_blank"&gt;https://community.esri.com/t5/arcgis-pro-questions/bd-p/arcgis-pro-questions&lt;/A&gt;&amp;nbsp;and tag it appropriately so it reaches the right community.&lt;/LI&gt;&lt;LI&gt;Open a case with technical support. It might be a known issue. If not - it should be.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Amir&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 08:06:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-parcel-fabric-questions/problem-using-scripts-to-calculate-fields-in/m-p/1231145#M875</guid>
      <dc:creator>AmirBar-Maor</dc:creator>
      <dc:date>2022-11-14T08:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using scripts to calculate fields in ArcPro Fabric Branched Versioning 3.0+</title>
      <link>https://community.esri.com/t5/arcgis-parcel-fabric-questions/problem-using-scripts-to-calculate-fields-in/m-p/1232798#M882</link>
      <description>&lt;P&gt;Hi Dean,&lt;/P&gt;&lt;P&gt;It would be nice if the Pro Mapping module had a refresh method for a current map or view object. This would make a great enhancement request.&lt;/P&gt;&lt;P&gt;We can hack a workaround using a selection and panning to the selection. I see in your UpdateCursor you are updating a specific feature. By using that feature's objectid, we can select it then pan to it. That should redraw the layers and show the edit.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# also get a map 'view' from the project
view = thisProject.activeView

with arcpy.da.UpdateCursor(AnnoLyr, ["MapNumber"], "OBJECTID = 7695") as cursor:
    for row in cursor:
        row[0] = MapNumber
        cursor.updateRow(row)
edit.stopOperation()
edit.stopEditing(save_changes=True)

# select the edited feature then pan to it
AnnoLyr.setSelectionSet([7695], "NEW")
view.panToExtent(view.getLayerExtent(AnnoLyr), selection_only=True)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if that helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ken&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 17:04:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-parcel-fabric-questions/problem-using-scripts-to-calculate-fields-in/m-p/1232798#M882</guid>
      <dc:creator>KenGalliher1</dc:creator>
      <dc:date>2022-11-17T17:04:38Z</dc:date>
    </item>
  </channel>
</rss>

