ArcPy RefreshCatalog() function for ArcGIS Pro

1631
12
08-21-2023 01:49 AM
Status: Under Consideration
Labels (1)
Clubdebambos
Frequent Contributor

ArcPy for ArcMap has a RefreshCatalog() function as per Esri documentation.

Can this function be made available for ArcGIS Pro?

12 Comments
Michele_Hosking

Yes please. It's so dumb that we can't do this anymore.  I have a python script.  It grabs attributes from one layer and updates the attribute tables of a bunch of other layers.  I have this script in a geoprocessing tool and it runs as a task.  It all works but requires the user to go to List by Data Source, find the right data connection (we have data from an enterprise geodatabase version, a different enterprise geodatabase, portal services and image services - so heaps of data source connections) and then right click and choose Refresh.

We are using tasks because most of these people aren't GIS people.  GIS is a small part of their job and this palaver is confusing - even though we have attempted to explain how as part of the task.

The major problem with this when the next task is run it's looking for attributes that were updated in the previous task but since ArcPro refuses to acknowledge that these actually have been changed this next task doesn't work unless above palaver is executed. So frustrating.

With all I've read Pro is supposed to update itself when things change if the script is run from inside ArcPro. I'm not referencing the data directly in our enterprise geodatabase from the script, I'm finding and using the layers from the pro project itself and I thought that would allow pro to know something had changed and refresh itself but it doesn't.

I can't even put it in as a hidden task as I found suggested.... somewhere on the interweb.... this simply doesn't work. 

This is a major annoyance.  Please can we get this sorted soon?

HannesZiegler
Status changed to: Needs Clarification

Thank you for sharing your idea with us. At the ArcGIS Pro 3.3 release, we have added RefreshLayer—ArcGIS Pro | Documentation and PauseDrawing—ArcGIS Pro | Documentation. To be clear, these two methods do not refresh the contents of the Catalog Pane. 

@Clubdebambos @Michele_Hosking I want to clarify that you are asking specifically for a method to refresh the contents of the Catalog Pane rather than the Contents Pane/Map View/Layer.

Some background:

The Catalog Pane is not the same as the Contents Pane.

To clarify, arcpy.RefreshLayer will cause a layer in the map view (present in the Contents Pane) and its table to update if you have made changes to it. For example, you have a layer symbolized a certain way based on the values in a particular field, and you change some of those values with an arcpy.da.UpdateCursor. Calling arcpy.RefreshLayer(<layer name>) will update the layer displayed in the map view and table to reflect the new values.

arcpy.PauseDrawing will pause updating the map view. For example, you are repeatedly running a tool in Python Window or a Notebook in Pro that repeatedly produces an output and adds it to the Map View, causing a lot of rapidly succeeding refreshes of the map and slowing down the overall operation. Using arcpy.PauseDrawing will defer the refresh until after all the outputs have been produced.

Neither of these functions affect the contents of Catalog Pane. Is your request specifically regarding the Catalog Pane, or do the above methods provide what you are looking for?

Thank you!

Michele_Hosking

HI there Hannes,

I'll try arcpy.RefreshLayer in my script - maybe that will work.  And no - I'm not talking about the Catalog pane.

Maybe you have solved my issue! 

I'll let you know.

HannesZiegler

@Michele_Hosking Excellent! Yes please let us know what you find

anonymous_geographer

@HannesZiegler- What I believe this original posting is asking for is an ArcPy equivalent to right-clicking a folder or file geodatabase within the Catalog pane and clicking Refresh. In many scenarios, I am not needing to load feature class output as layers into the map, so that RefreshLayer() tool would not apply to those scenarios.

Example. If A) I'm actively connected to my Pro project's default file geodatabase (ex: Counties.gdb) through the Catalog pane, and if B) I use a geoprocessing tool within my custom Python toolbox that saves the feature class output to my Pro project's default geodatabase, then C) new output will not appear in that file geodatabase until I manually right-click it and Refresh within the Catalog pane. Does that clear things up? It seems like such a trivial piece of ArcPy functionality, and existed in ArcMap as RefreshCatalog(). We'd assume there'd be a RefreshCatalogPane() or something like that.

anonymous_geographer_0-1719503220850.png

 

Clubdebambos

Hi @HannesZiegler,

Pretty much as @anonymous_geographer stated above. A manual refresh is required to see the newly created feature class. 

With ArcGIS Pro, when I have used ArcPy to alter a feature class, say the schema, a manual refresh doesnt reflect the change, I have to close down and reopen Pro to see the change take affect, this was never the case with ArcMap and using the RefreshCatalog() function.

To answer your question, this specific request is specifically related to the Catalog Pane and removing the need to refresh manually by implementing the RefreshCatalog() function that was available with ArcMap.

All the best,

Glen

HannesZiegler
Status changed to: Under Consideration

Thank you all for the clarification. Based on your feedback and discussions with the team I've moved this idea into "Under Consideration". We encourage the community to continue voting and sharing feedback which will help us gauge user demand.

Michele_Hosking

I must be doing something wrong but as far as I can see arcpy.RefreshLayer() doesn't work. I deliberately upgraded to 3.3.0 to get this functionality. 

I've included my script below in case there are any clues in it as to why it's not working.

This script is set up as a tool in a toolbox.  It has validation set up so a person choses the layer to run the script for from a drop-down list of available layers in the current map and then a list of available agreement numbers is populated to chose from.

I've put the refresh layer statement at the end of the script as it might loop through a number of times depending on how many agreement numbers is chosen to run it for. I thought one layer refresh would be fine at the end.

I've tried arcpy.RefreshLayer(futureLayer) which is looking at the layer as chosen by the user from the current map.

I've tried arcpy.RefreshLayer(futureDataEntry) which is the same layer but is the variable I actually use in the script (you can see how it's defined below).  Not sure if I still need to do this as I have pulled the script directly across from an ArcMap plugin but a million years ago when I created this I obviously thought I needed it....

Anyway - neither of these refresh the layer or attribute table in the current map.

See below the python code for images of the results (or non-results)

Not sure why this is so hard.

P.S. - this is a different application to that I described in a previous post on this topic but RefreshLayer doesn't work for me in that other application either.

 

# Set up variables
futureLayer = arcpy.GetParameterAsText(0)
agreementNumberList = arcpy.GetParameterAsText(1)
agreementNumber = agreementNumberList.split(";")

desc = arcpy.Describe(futureLayer)
futureDataEntry = str(desc.path) + "\\" + str(desc.name)

#There are some other set up variable here but I've taken them out

# Definitions
#There are a bunch of definitions that do stuff - don't know that they are required for this purpose.
      
# Run Script
arcpy.AddMessage("%s" %os.path.basename(futureDataEntry))
CreateWorkingFGDB(workingFGDB)

for number in agreementNumber:
    # Update LandUseID's in NDMS_FutureAllocation_DataEntry
    arcpy.AddMessage("Update LandUseID's for %s" %number)
    maxID = max(FindMaxID(futureDataEntry, activated))
    arcpy.MakeFeatureLayer_management(futureDataEntry, "FutureLayer")
    
    # Update LandUseID for repeated LandUseID's in selected PIN Numbers
    if CheckSpace(number) == True:
        selectionExpression = "AgreementNumber <> " + number + " AND FA_LandUseID is not null"
    else:
        selectionExpression = "AgreementNumber <> '" + number + "' AND FA_LandUseID is not null"
    
    arcpy.SelectLayerByAttribute_management("FutureLayer", "NEW_SELECTION", selectionExpression)
    uniqueList = UniqueList("FutureLayer", "FA_LandUseID")
    
    if CheckSpace(number) == True:
        selectionExpression = "AgreementNumber = " + number
    else:
        selectionExpression = "AgreementNumber = '" + number + "'"
        
    arcpy.SelectLayerByAttribute_management("FutureLayer", "NEW_SELECTION", selectionExpression)

    cursor = arcpy.UpdateCursor("FutureLayer")
    checkDouble = []
    for row in cursor:
        if row.getValue("FA_LandUseID") in uniqueList or row.getValue("FA_LandUseID") in checkDouble:
            maxID = maxID + 1
            row.setValue("FA_LandUseID", maxID)
            cursor.updateRow(row)
        checkDouble.append(row.getValue("FA_LandUseID"))
        
    # Update LandUseID for null or 0 values for selected Agreement Numbers
    maxID = max(FindMaxID(futureDataEntry, activated))
    
    if CheckSpace(number) == True:
        selectionExpression = "AgreementNumber = " + number + "AND (FA_LandUseID is null OR FA_LandUseID = 0)"
    else:
        selectionExpression = "AgreementNumber = '" + number + "'AND (FA_LandUseID is null OR FA_LandUseID = 0)"
        
    arcpy.SelectLayerByAttribute_management("FutureLayer", "NEW_SELECTION", selectionExpression)
    expression = "autoIncrement(" + str(maxID) + ")"
    codeblock = """rec=0
def autoIncrement(maxID):
    global rec
    pStart = maxID + 1
    pInterval = 1
    if (rec == 0):
        rec = pStart
    else:
        rec += pInterval
    return rec"""
    
    calculateFieldList = ["FA_LandUseID", expression, codeblock]
    CalculateField("FutureLayer", calculateFieldList)
    
# ---------------------------------------------------------------------------
    # Export AgreementNumber to working file for the rest of the processing
    CheckExists(f01)
    arcpy.AddMessage("Select Agreement Number %s" %number)
    
    if CheckSpace(number) == True:
        selectionExpression = "AgreementNumber = " + number
    else:
        selectionExpression = "AgreementNumber = '" + number + "'"
    
    arcpy.SelectLayerByAttribute_management("FutureLayer", "NEW_SELECTION", selectionExpression)
       
    arcpy.AddMessage("Export %s to %s" %(number, os.path.basename(f01)))
    arcpy.CopyFeatures_management("FutureLayer", f01)
    
    arcpy.SelectLayerByAttribute_management("FutureLayer", "CLEAR_SELECTION")
    
    # Update FA_LandUse and FA_Sector
    arcpy.AddMessage("Calculate FA_LandUse and FA_Sector for %s" %number)
    arcpy.MakeFeatureLayer_management(f01, "F01")
    arcpy.AddJoin_management("F01", "FA_BlockType", blockTypeLookup, "BlockType", "KEEP_ALL")
    calculateFieldList = [
                            [os.path.basename(f01) + ".FA_LandUse", "!" + os.path.basename(blockTypeLookup) + ".LandUse!",  ""],
                            [os.path.basename(f01) + ".FA_Sector",  "!" + os.path.basename(blockTypeLookup) + ".Sector!",  ""]
                         ]
    for calcField in calculateFieldList:
        CalculateField("F01", calcField)    
    arcpy.RemoveJoin_management("F01")    
    
    if f01 not in cleanUpList:
        cleanUpList.append(f01)

# ---------------------------------------------------------------------------
    # Create mean slope for each block in the Agreement Number
    CheckExists(t03)
    arcpy.AddMessage("Calculate slope statistics for %s" %number)
    arcpy.sa.ZonalStatisticsAsTable(f01, "FA_LandUseID", slope, t03, "DATA", "MEAN")
    arcpy.MakeFeatureLayer_management(f01, "F01")
    arcpy.AddJoin_management("F01", "FA_LandUseID", t03, "FA_LandUseID", "KEEP_ALL")
    calculateFieldList = [os.path.basename(f01) + ".FA_SlopeMean", "round(!" + os.path.basename(t03) + ".Mean! / 100, 2)", ""]
    CalculateField("F01", calculateFieldList)
    arcpy.RemoveJoin_management("F01")

    # Calculate slope category
    selectionExpression = "FA_SlopeMean < 8"
    arcpy.SelectLayerByAttribute_management("F01", "NEW_SELECTION", selectionExpression)
    arcpy.CalculateField_management("F01", "FA_SlopeCategory", "\"Flat\"","PYTHON_9.3")
    selectionExpression = "FA_SlopeMean >= 8 AND FA_SlopeMean < 16"
    arcpy.SelectLayerByAttribute_management("F01", "NEW_SELECTION", selectionExpression)
    arcpy.CalculateField_management("F01", "FA_SlopeCategory", "\"Rolling\"","PYTHON_9.3")
    selectionExpression = "FA_SlopeMean >= 16 AND FA_SlopeMean < 26"
    arcpy.SelectLayerByAttribute_management("F01", "NEW_SELECTION", selectionExpression)
    arcpy.CalculateField_management("F01", "FA_SlopeCategory", "\"Easy Hill\"","PYTHON_9.3")
    selectionExpression = "FA_SlopeMean >= 26"
    arcpy.SelectLayerByAttribute_management("F01", "NEW_SELECTION", selectionExpression)
    arcpy.CalculateField_management("F01", "FA_SlopeCategory", "\"Steep Hill\"","PYTHON_9.3")
    
    arcpy.SelectLayerByAttribute_management("F01", "CLEAR_SELECTION")

    if t03 not in cleanUpList:
        cleanUpList.append(t03)

# --------------------------------------------------------------------------- 
    # Create latitude and longitude for each block in the Agreement Number
    CheckExists(f02)
    CheckExists(f03)
    arcpy.AddMessage("Calculate latitude and longitude for %s" %number)
    arcpy.FeatureToPoint_management(f01, f02, "INSIDE")
    spatialRef = arcpy.Describe(spatialRefWGS84).spatialReference
    arcpy.Project_management(f02, f03, spatialRef, "NZGD_2000_To_WGS_1984_1")
    calculateFieldList = [
                           ["FA_Latitude",  "round(!shape.centroid.Y!,4)", ""],
                           ["FA_Longitude", "round(!shape.centroid.X!,4)", ""]
                         ]
    for calcField in calculateFieldList:
        CalculateField(f03, calcField)
        
    arcpy.AddJoin_management("F01", "FA_LandUseID", f03, "FA_LandUseID", "KEEP_ALL")
    calculateFieldList = [
                           [os.path.basename(f01) + ".FA_Latitude",  "!" + os.path.basename(f03) + ".FA_Latitude!",  ""],
                           [os.path.basename(f01) + ".FA_Longitude", "!" + os.path.basename(f03) + ".FA_Longitude!", ""]
                         ]
    for calcField in calculateFieldList:
        CalculateField("F01", calcField)
    arcpy.RemoveJoin_management("F01")
        
    if f02 not in cleanUpList:
        cleanUpList.append(f02)
        
    if f03 not in cleanUpList:
        cleanUpList.append(f03)
        
# ---------------------------------------------------------------------------
    # Update SoilData
    arcpy.AddMessage("Update Soil data for %s" %number)
    CheckExists(t01)
    CheckExists(t02)
    
    arcpy.TabulateIntersection_analysis(f01, ["FA_LandUseID"], soil, t01, "SmapName")

    addFieldList = ["JoinField", "TEXT", "", "", 20]
    AddField(t01, addFieldList)

    calculateFieldList = ["JoinField", "str(!FA_LandUseID!) + \" \" + str(round(!PERCENTAGE!, 4))", ""]
    CalculateField(t01, calculateFieldList)
    arcpy.Statistics_analysis(t01, t02, [["PERCENTAGE", "MAX"]], "FA_LandUseID")

    addFieldList = ["JoinField", "TEXT", "", "", 20]
    AddField(t02, addFieldList)
    calculateFieldList = ["JoinField", "str(!FA_LandUseID!) + \" \" + str(round(!MAX_PERCENTAGE!, 4))", ""]
    CalculateField(t02, calculateFieldList)
    
    arcpy.JoinField_management(t02, "JoinField", t01, "JoinField", ["SmapName"])
    arcpy.AddJoin_management("F01", "FA_LandUseID", t02, "FA_LanduseID", "KEEP_ALL")

    calculateFieldList = [
                           [os.path.basename(f01) + ".FA_SmapName",            "!" + os.path.basename(t02) + ".SmapName!", ""],
                           [os.path.basename(f01) + ".FA_DominantSoilPercent", "round(!" + os.path.basename(t02) + ".MAX_PERCENTAGE!, 0)", ""]
                         ]
    for calcField in calculateFieldList:
        CalculateField("F01", calcField)
        
    arcpy.RemoveJoin_management("F01")  
    
    if t01 not in cleanUpList:
        cleanUpList.append(t01)
            
    if t02 not in cleanUpList:
        cleanUpList.append(t02)
 
# ---------------------------------------------------------------------------
    # Update F01 for soil data
    arcpy.AddJoin_management("F01", "FA_SmapName", soilTable, "SmapName_SiblingName", "KEEP_ALL")
    arcpy.SelectLayerByAttribute_management("F01", "CLEAR_SELECTION")
    calculateFieldList = [ 
                            [os.path.basename(f01) + ".FA_FamilyName",                  "!" + os.path.basename(soilTable) + ".FamilyName!",                  ""],           
                            [os.path.basename(f01) + ".FA_SoilOrder",                   "!" + os.path.basename(soilTable) + ".SoilOrder!",                   ""],
                            [os.path.basename(f01) + ".FA_MaximumRootingDepth_cm",      "!" + os.path.basename(soilTable) + ".MaximumRootingDepth_cm!",      ""],
                            [os.path.basename(f01) + ".FA_DepthToImpededDrainage_m",    "!" + os.path.basename(soilTable) + ".DepthToImpededDrainage_m!",    ""],
                            [os.path.basename(f01) + ".FA_WiltingPoint_0_30_cm",        "!" + os.path.basename(soilTable) + ".WiltingPoint_0_30cm!",         ""],
                            [os.path.basename(f01) + ".FA_WiltingPoint_30_60_cm",       "!" + os.path.basename(soilTable) + ".WiltingPoint_30_60cm!",        ""],
                            [os.path.basename(f01) + ".FA_WiltingPoint_60_cm",          "!" + os.path.basename(soilTable) + ".WiltingPoint_60cm!",           ""],
                            [os.path.basename(f01) + ".FA_FieldCapacity_0_30_cm",       "!" + os.path.basename(soilTable) + ".FieldCapacity_0_30cm!",        ""],
                            [os.path.basename(f01) + ".FA_FieldCapacity_30_60_cm",      "!" + os.path.basename(soilTable) + ".FieldCapacity_30_60cm!",       ""],
                            [os.path.basename(f01) + ".FA_FieldCapacity_60_cm",         "!" + os.path.basename(soilTable) + ".FieldCapacity_60cm!",          ""],
                            [os.path.basename(f01) + ".FA_Saturation_0_30_cm",          "!" + os.path.basename(soilTable) + ".Saturation_0_30cm!",           ""],
                            [os.path.basename(f01) + ".FA_Saturation_30_60_cm",         "!" + os.path.basename(soilTable) + ".Saturation_30_60cm!",          ""],
                            [os.path.basename(f01) + ".FA_Saturation_60_cm",            "!" + os.path.basename(soilTable) + ".Saturation_60cm!",             ""],
                            [os.path.basename(f01) + ".FA_NaturalDrainageClass",        "!" + os.path.basename(soilTable) + ".NaturalDrainageClass!",        ""],
                            [os.path.basename(f01) + ".FA_AnionStorageCapacityPercent", "!" + os.path.basename(soilTable) + ".AnionStorageCapacityPercent!", ""],
                            [os.path.basename(f01) + ".FA_SubsoilClayPercent",          "!" + os.path.basename(soilTable) + ".SubsoilClayPercent!",          ""],
                            [os.path.basename(f01) + ".FA_BulkDensity_KgPerM3",         "!" + os.path.basename(soilTable) + ".BulkDensityKgPerM3!",          ""],
                            [os.path.basename(f01) + ".FA_ClayPercent",                 "!" + os.path.basename(soilTable) + ".ClayPercent!",                 ""],
                            [os.path.basename(f01) + ".FA_SandPercent",                 "!" + os.path.basename(soilTable) + ".SandPercent!",                 ""]
                         ]
    for calcField in calculateFieldList:
        CalculateField("F01", calcField)
    arcpy.RemoveJoin_management("F01", os.path.basename(soilTable))
    arcpy.CalculateField_management("F01", "FA_AreaHA", "!shape.area@hectares!", "PYTHON_9.3", "")
    
 # ---------------------------------------------------------------------------         
    # Update NDMS_FutureAllocation_DataEntry for Slope, Latitude, Longitude, Area, SmapName and Dominant Soil Percent
    cursorFields = ["FA_LandUseID",                   #0
                    "FA_SlopeMean",                   #1 [0,0]
                    "FA_SlopeCategory",               #2
                    "FA_LandUse",                     #3
                    "FA_Sector",                      #4
                    "FA_Latitude",                    #5
                    "FA_Longitude",                   #6
                    "FA_SmapName",                    #7
                    "FA_DominantSoilPercent",         #8
                    "FA_FamilyName",                  #9
                    "FA_SoilOrder",                   #10
                    "FA_MaximumRootingDepth_cm",      #11
                    "FA_DepthToImpededDrainage_m",    #12
                    "FA_WiltingPoint_0_30_cm",        #13
                    "FA_WiltingPoint_30_60_cm",       #14
                    "FA_WiltingPoint_60_cm",          #15
                    "FA_FieldCapacity_0_30_cm",       #16 [0,15]
                    "FA_FieldCapacity_30_60_cm",      #17
                    "FA_FieldCapacity_60_cm",         #18
                    "FA_Saturation_0_30_cm",          #19
                    "FA_Saturation_30_60_cm",         #20
                    "FA_Saturation_60_cm",            #21
                    "FA_NaturalDrainageClass",        #22
                    "FA_AnionStorageCapacityPercent", #23
                    "FA_SubsoilClayPercent",          #24
                    "FA_BulkDensity_KgPerM3",         #25
                    "FA_ClayPercent",                 #26
                    "FA_SandPercent",                 #27 [0,26]
                    "FA_AreaHA"]                      #28
    
    searchDict = {}
    with arcpy.da.SearchCursor(f01, cursorFields) as sCursor:
        for row in sCursor:
            searchDict.update({row[0]:[row[1],row[2],row[3],row[4],row[5],row[6],row[7],row[8],row[9],row[10],
                                       row[11],row[12],row[13],row[14],row[15],row[16],row[17],row[18],row[19],
                                       row[20],row[21],row[22],row[23],row[24],row[25],row[26],row[27], row[28]]})
    
    with arcpy.da.UpdateCursor(futureDataEntry, cursorFields) as uCursor:
        for row in uCursor:
            if row[0] in searchDict:
                row[1] = searchDict[row[0]][0]
                row[2] = searchDict[row[0]][1]
                row[3] = searchDict[row[0]][2]
                row[4] = searchDict[row[0]][3]
                row[5] = searchDict[row[0]][4]
                row[6] = searchDict[row[0]][5]
                row[7] = searchDict[row[0]][6]
                row[8] = searchDict[row[0]][7]
                row[9] = searchDict[row[0]][8]
                row[10] = searchDict[row[0]][9]
                row[11] = searchDict[row[0]][10]
                row[12] = searchDict[row[0]][11]
                row[13] = searchDict[row[0]][12]
                row[14] = searchDict[row[0]][13]
                row[15] = searchDict[row[0]][14]
                row[16] = searchDict[row[0]][15]
                row[17] = searchDict[row[0]][16]
                row[18] = searchDict[row[0]][17]
                row[19] = searchDict[row[0]][18]
                row[20] = searchDict[row[0]][19]
                row[21] = searchDict[row[0]][20]
                row[22] = searchDict[row[0]][21]
                row[23] = searchDict[row[0]][22]
                row[24] = searchDict[row[0]][23]
                row[25] = searchDict[row[0]][24]
                row[26] = searchDict[row[0]][25]
                row[27] = searchDict[row[0]][26]
                row[28] = searchDict[row[0]][27]
                uCursor.updateRow(row)

    del sCursor
    del uCursor

# ---------------------------------------------------------------------------
    CleanUp(cleanUpList)
# ---------------------------------------------------------------------------
arcpy.RefreshLayer(futureDataEntry)
arcpy.AddMessage("*****ALL DONE*****")

 

 

This is the attribute table before the script has run and as it still appears after the script has run - and yes ok - but you have to have some fun when you're pulling your hair out!

Michele_Hosking_3-1721163092890.png

I've also tried pushing the useless refresh buttons...

Michele_Hosking_1-1721162871861.png

...on both the map and the attribute table - no idea why they are there.

The second image below is the attribute table after I have clicked the following

Michele_Hosking_2-1721162944992.png

Michele_Hosking_4-1721163207041.png

Just a thought - does this RefreshLayer not work when a layer is registered as versioned?  If not - why not?

 

 

 

HannesZiegler

 

@Michele_Hosking wrote:

Just a thought - does this RefreshLayer not work when a layer is registered as versioned?  If not - why not?


Firstly, thank you for the write up, nothing inherently wrong stood out to me in your script. Secondly, with regard to your quote above - that is correct, have a look at Branch version scenarios—ArcGIS Pro | Documentation, it states the following:

HannesZiegler_1-1723489010106.png

Per our expert in this area:

Pro is a consistent state\moment client for multi-user enterprise geodatabase environments. What that means is they maintain a consistent view of the data until the refresh version moves that state\moment forward.

For layers registered as traditional versioned (stateID) or branch versioned (moment) this pattern should hold true.

For layers not registered as versioned the RefreshLayer workflow should show changes from other users made since the last call. 

I would expect this pattern to hold true for branch versioned Feature services as well.

In short, refreshing multi-user enterprise geodatabase requires explicitly refreshing their data source due to the data model, this is as-designed. arcpy.RefreshLayer is not designed to work for these data sources.

 

 

 

Michele_Hosking

Ok - in this particular case the feature layer is traditionally versioned but I'm working in the default version (although in other cases I am working in an actual version of the data).  And I'm not after seeing changes from other users - I'm after seeing changes made by me, in the default version via a script running from a toolbox using layers currently in the project. How do I get these changes to show straight away in my current pro session?

Do I have to work in an actual version and then - reconcile? Does the reconcile do the required refresh even though I'm not trying to pull down changes from other users?

It would be so much easier if we could just have an arcpy command to do the refresh that is required.  Please?

We really need a way to programmatically refresh the data shown so the changes made by the script are showing in the project without the manual refresh.  That manual refresh just confuses the non-gis people I am trying to enable via all this automation.

Thanks for your help.