POST
|
John, Thank you for you thoughtful reply and list of suggestions. I was called away to work on another project so I'm just now able to get back to this issue. I have applied your suggestions to my function (see the revised code below). The result is just the same as before. I'm still getting the same generic "Edit operation failed" that I was getting before and it is still just as random as before. The error still occurs on the insp.ApplyAsync() function call. I also tried await insp.LoadAsync() but that didn't help. Could this be a bug within the inspector.ApplyAsync() function call? If you have any other suggestions, I would appreciate the help. ArcGIS Pro 2.0, Visual Studio 2017 community edition, file geodatabase. internal static async Task<int> UpdateBoundarySubdivisionAttribute(string strSelectedAppNo, string strNewSubdivisions) { Debug.WriteLine(" UpdateBoundarySubdivisionAttribute() start"); try { await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(async () => { // Find boundary layer. var disLayer = ArcGIS.Desktop.Mapping.MapView.Active.Map.FindLayers(Settings.Get("pyp_boundary_layer_name")).FirstOrDefault() as BasicFeatureLayer; // Search by application number attribute. var queryFilter = new ArcGIS.Core.Data.QueryFilter { WhereClause = "APPLICATION_NUMBER = '" + strSelectedAppNo + "'" }; // Add each ObjectID to the List. var oidSet = new List<long>(); using (RowCursor rc = disLayer.Search(queryFilter)) { while (rc.MoveNext()) { oidSet.Add(rc.Current.GetObjectID()); } } // There should be one ObjectID - boundary feature. if (oidSet.Count < 1) { // This shouldn't happen. There should always be one boundary feature for this AppNo. return; } // Create Inspector. ArcGIS.Desktop.Editing.Attributes.Inspector insp = new ArcGIS.Desktop.Editing.Attributes.Inspector(); insp.Load(disLayer, oidSet); insp["SUBDNAME"] = strNewSubdivisions; if (true != await insp.ApplyAsync()) { return; // Return error } }); // Return success return 0; } catch (Exception ex) { string ERR_PROC = " UpdateBoundarySubdivisionAttribute() "; System.Windows.MessageBox.Show("ErrProcedure = " + ERR_PROC + ex.Message, "Update Boundary Subdivision Error", MessageBoxButton.OK, MessageBoxImage.Error); return 1; // Return error } }
... View more
08-07-2018
07:04 AM
|
1
|
1
|
1851
|
POST
|
I'm getting an intermittent error during an editing. This code is running as part of a Pro Add-in that I'm writing. The error doesn't happen every time this function runs but if I repeatedly run this function it will eventually fail. Sometimes it will take 2 tries and other times it will take 20 ties. When running through Visual Studio it will error more frequently. When running as the compiled Add-in, it takes longer to error. It fails at the insp.ApplyAsync() call with an error message with the heading "Update Feature Attributes" and the message text of "Edit operation failed.". This is some very generic message. Another strange thing is that it doesn't hit my error handling for this initial message but after I close the initial message it will then drop to my error handling. Part of the application's requirements is that I don't need to prompt the user to save edits. I've also tried EditOperation combined with SaveEditsAsync() with the same error results. The feature class is stored in a file geodatabase on my local drive. ArcGIS Pro 2.0 Does anyone know how to prevent this error or code around it somehow? internal static async Task<int> UpdateBoundarySubdivisionAttribute(string strSelectedAppNo, string strNewSubdivisions) { try { await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(async () => { // Find boundary layer. var disLayer = ArcGIS.Desktop.Mapping.MapView.Active.Map.FindLayers(Settings.Get("pyp_boundary_layer_name")).FirstOrDefault() as BasicFeatureLayer; // Search by application number attribute. var queryFilter = new ArcGIS.Core.Data.QueryFilter(); queryFilter.WhereClause = "APPLICATION_NUMBER = '" + strSelectedAppNo + "'"; var rc = disLayer.Search(queryFilter); // Create list of oids to update. There should only be one. var oidSet = new List<long>(); while (rc.MoveNext()) { oidSet.Add(rc.Current.GetObjectID()); } // Create Inspector. var insp = new ArcGIS.Desktop.Editing.Attributes.Inspector(); insp.Load(disLayer, oidSet); insp["SUBDNAME"] = strNewSubdivisions; // Save edits with no undo. If you want the undo option then use EditOperation(). if (true != await insp.ApplyAsync()) // <-- point of error "Update Feature Attributes" "Edit operation failed." { string ERR_PROC = " UpdateBoundarySubdivisionAttribute() "; System.Windows.MessageBox.Show("Error in ApplyAsync() ErrProcedure = " + ERR_PROC + " Unable to save edits the the feature class.", "Update Boundary Subdivision Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } }); return await Task.FromResult(0); } catch (Exception ex) { string ERR_PROC = " UpdateBoundarySubdivisionAttribute() "; System.Windows.MessageBox.Show("ErrProcedure = " + ERR_PROC + ex.Message, "Update Boundary Subdivision Error", MessageBoxButton.OK, MessageBoxImage.Error); return await Task.FromResult(1); // Return error } }
... View more
06-27-2018
08:09 AM
|
0
|
3
|
2574
|
POST
|
Thank you Charles. This is not really the direction I wanted to go for a solution.
... View more
03-20-2018
01:27 PM
|
0
|
0
|
3261
|
POST
|
Thank you M Ka. Your was solution worked very well.
... View more
03-20-2018
01:25 PM
|
0
|
3
|
3261
|
POST
|
Thank you for your quick replay. I'm glad to hear that using an app.config is possible. Ok. I did as you suggested and set the Build Action to "Content" and the Copy to Output Directory to "Copy Always" but it didn't seem to help. I also tried using <appSettings> and it didn't find that setting either. Is there anything special in the way you Get the setting? I tried in debug mode and as a compiled Add-In with no difference. connectionString = System.Configuration.ConfigurationManager.AppSettings.Get("pd_apps_conn"); <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="pd_apps_conn" value="Data Source=xx.xx.xx.xxx;Initial Catalog=some_db;User ID=xxx;Password=yyy" /> </appSettings> <connectionStrings> <add name="pd_apps" connectionString="Data Source=xx.xx.xx.xxx;Initial Catalog=some_db;User ID=xxx;Password=yyy" /> </connectionStrings> </configuration>
... View more
03-20-2018
07:22 AM
|
0
|
5
|
3261
|
POST
|
Has anyone successfully used an app.config file with your Add-In? I have added an app.config file to my visual studio pro SDK project and I’m trying to retrieve a connection string from it. The retrieval code always returns null. I don’t know if that’s because it is a UserControl or running inside ArcGIS Pro or what. Any thoughts? Is there a better place to store the connection string? Visual Studio 2017, .Net Framework 4.6.1, ArcGIS Pro SDK 2.1, SQL Server app.config <?xml version="1.0" encoding="utf-8" ?> <configuration> <connectionStrings> <add name="my_conn" connectionString="Data Source=xx.xx.xx.xxx;Initial Catalog=some_db;User ID=xxx;Password=yyy" /> </connectionStrings> </configuration> c# code // Assume failure. string returnValue = null; // Look for the name in the connectionStrings section. ConnectionStringSettings settings = ConfigurationManager.ConnectionStrings["my_conn"]; // If found, return the connection string. if (settings != null) returnValue = settings.ConnectionString;
... View more
03-20-2018
05:51 AM
|
0
|
13
|
4959
|
POST
|
I have added an app.config file to my visual studio pro SDK project and I’m trying to retrieve a connection string from it. The retrieval code always returns null. I don’t know if that’s because it is a UserControl or running inside ArcGIS Pro or what. Any thoughts? Is there a better place to store the connection string? Visual Studio 2017, .Net Framework 4.6.1, ArcGIS Pro SDK 2.1, SQL Server app.config <?xml version="1.0" encoding="utf-8" ?> <configuration> <connectionStrings> <add name="my_conn" connectionString="Data Source=xx.xx.xx.xxx;Initial Catalog=some_db;User ID=xxx;Password=yyy" /> </connectionStrings> </configuration> c# code // Assume failure. string returnValue = null; // Look for the name in the connectionStrings section. ConnectionStringSettings settings = ConfigurationManager.ConnectionStrings["my_conn"]; // If found, return the connection string. if (settings != null) returnValue = settings.ConnectionString;
... View more
03-19-2018
11:35 AM
|
0
|
0
|
3571
|
POST
|
Is there a way in Arcpy, to loop through the symbol collection to get back some attributes of each item in the symbol collection list (symbol ID, symbol name, font size, etc.)? I'm working in ArcGIS desktop 10.4. I need to do this in arcpy, but what I'm talking about is the information that you see in ArcCatalog's Annotation tab of the Feature Class Properties dialog. There is a list box with the title "Symbol Collection". The symbol ID appears in parenthesis and right next to it is symbol name. As seen in the image below, if I could get this information through Arcpy, it would be ideal. ID = 14, Name = size_1 ID = 23, Name = size_10 ID = 113, Name = size_100
... View more
12-01-2016
08:20 AM
|
0
|
1
|
1025
|
POST
|
ArcGIS Server 10 I have published a model to run as a geoprocessing service. The model uses the ArcToolbox Synchronize Changes tool. When I run the GP service, it causes this error. esriJobMessageTypeError: ERROR 000655: An error was encountered while Validating Synchronize. It seems to lose the name of the replica somehow. When I validate the model again, it finds it. It seems to run fine through the model builder interface. When running as a published service, it doesn't do so well. Any thoughts?
... View more
10-05-2012
07:17 AM
|
0
|
2
|
1385
|
POST
|
Why does the append annotation to feature class tool create duplicate fields and annotation classes? When I run it multiple times using the same input dataset, it creates the same fields over and over in the output feature class. I end up with attribute fields like: AppID, AppID_1, AppID_2 And Annotation Classes like: PLAT, Annotation1_PLAT, Annotation1_PLAT_1 I would like to have one set of fields and one set of Annotation Classes that each append process just adds records to. Any help would be apprecieated.
... View more
04-23-2012
06:58 AM
|
0
|
1
|
1568
|
POST
|
2. The second option involves AutoCad, if you have the software available it is possible to georeference it to a dataset that has a correct spatial reference through a few simple steps. I have documented these steps which may prove useful to you if this is a viable option, this can then be used to create the GDB using CAD features. WarrenDz, If you could post the steps for correcting the spatial reference in AutoCAD, it would be very helpful.
... View more
04-16-2012
11:28 AM
|
0
|
0
|
739
|
POST
|
That solution worked Neil. Thanks again. You are the best. Bill
... View more
03-21-2012
08:21 AM
|
0
|
0
|
523
|
POST
|
Thanks Neil. I looked at the documentation and that is quite a process. I'll go through it and hopefully all will go well. I'll let you know if I can get it to work or ask more questions. This may take a day or two.
... View more
03-19-2012
07:05 AM
|
0
|
0
|
523
|
POST
|
Neil, If you could tell me how to register with the setup, I would be most grateful.
... View more
03-14-2012
10:19 AM
|
0
|
0
|
523
|
POST
|
Thank you Neil for your input. I use a visual studio 10 setup.exe to copy the dll and tlb to the windows XP target machine and I use the Add From File on the Customize dialog to register my ArcMap 10 tools. Everything works fine but the DockableWindow. The code you suggested is already in my class.
Public Class frmCLApps
Implements IDockableWindowDef
#Region "COM GUIDs"
' These GUIDs provide the COM identity for this class
' and its COM interfaces. If you change them, existing
' clients will no longer be able to access the class.
Public Const ClassId As String = "8582b32d-120c-407b-af34-8719b8960b30"
Public Const InterfaceId As String = "fec13c95-bd53-44cd-b8ef-f7d83f33fbb2"
Public Const EventsId As String = "1e9d36cc-df74-40c4-a8a7-461a0f75b13d"
#End Region
#Region "COM Registration Function(s)"
<ComRegisterFunction(), ComVisibleAttribute(False)> _
Public Shared Sub RegisterFunction(ByVal registerType As Type)
' Required for ArcGIS Component Category Registrar support
ArcGISCategoryRegistration(registerType)
'Add any COM registration code after the ArcGISCategoryRegistration() call
End Sub
<ComUnregisterFunction(), ComVisibleAttribute(False)> _
Public Shared Sub UnregisterFunction(ByVal registerType As Type)
' Required for ArcGIS Component Category Registrar support
ArcGISCategoryUnregistration(registerType)
'Add any COM unregistration code after the ArcGISCategoryUnregistration() call
End Sub
#Region "ArcGIS Component Category Registrar generated code"
''' <summary>
''' Required method for ArcGIS Component Category registration -
''' Do not modify the contents of this method with the code editor.
''' </summary>
Private Shared Sub ArcGISCategoryRegistration(ByVal registerType As Type)
Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)
GMxDockableWindows.Register(regKey)
MxDockableWindows.Register(regKey)
SxDockableWindows.Register(regKey)
GxDockableWindows.Register(regKey)
End Sub
''' <summary>
''' Required method for ArcGIS Component Category unregistration -
''' Do not modify the contents of this method with the code editor.
''' </summary>
Private Shared Sub ArcGISCategoryUnregistration(ByVal registerType As Type)
Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)
GMxDockableWindows.Unregister(regKey)
MxDockableWindows.Unregister(regKey)
SxDockableWindows.Unregister(regKey)
GxDockableWindows.Unregister(regKey)
End Sub
#End Region
#End Region
After going through my installation on the target machine, I searched the registry for the key "8582b32d-120c-407b-af34-8719b8960b30". It was in the registry associated with my form that implements IDockableWindowDef. So, I'm still missing some critical part here. Thanks again for the help.
... View more
03-13-2012
06:56 AM
|
0
|
0
|
523
|
Title | Kudos | Posted |
---|---|---|
1 | 09-07-2021 09:47 AM | |
1 | 08-07-2018 07:04 AM | |
2 | 05-08-2020 08:26 AM | |
1 | 05-07-2020 01:11 PM |
Online Status |
Offline
|
Date Last Visited |
09-15-2021
01:20 PM
|