featureClass.deleteSearchedRows not deleting features

1747
4
Jump to solution
07-16-2014 12:56 PM
PeterLen
Occasional Contributor

I am using the Java ArcObjects API for ArcGIS 10.  I have a FeatureClass object for a feature class table within a file geo-database.  I want to remove all of the features so am using the featureClass.deleteSearchedRows(null) call.  I use "nul" as the query filter in order to get all of the items.  I have tested this on a test file geodatabase and it works fine.  When I try to use it on another local file geodatabase that already existed, it does not.  The code runs without any errors but when I go to view the feature class in ArcCatalog, all the rows are still there.  Initially I thought that maybe it was a permissions issue but I would have figured that a permission error would have been thrown.  The problem here is that because no error is being thrown, my code wants to go on and re-populate the feature class with other items but if the feature class still contains the previous items, I have a problem.  Any clue as to what might be happening?

Thanks - Peter

0 Kudos
1 Solution

Accepted Solutions
PeterLen
Occasional Contributor


Okay, I sort of solved it.  It must have been strictly a permissions issue.  I had been running the tests via Eclipse.  I decided to open Eclipse as an Administrator and all ran fine.  This seems odd though because if I run the application (as myself) and try to rename or delete an existing feature class table in a file GDB that someone else created, I get an "Access Denied" exception.  I would have expected the same behavior when deleting rows from a table given that it wouldn't delete the rows.  Maybe it wasn't an "access" issue but all I know is that it runs fine if I run the app as an Administrator.

View solution in original post

0 Kudos
4 Replies
DuncanHornby
MVP Notable Contributor

Peter,

You show a line using the deleteSearchedRows method but you say "I want to remove all of the features...". So which is it? Are you wanting to remove ALL features regardless of any selection or remove only the SELECTED features?

If you want to remove ALL features have you considered calling the geo-processing tool Truncate Table?

Duncan

0 Kudos
PeterLen
Occasional Contributor

Thanks for the response Duncan.  I use the deleteSearchedRows with the "null" parameter to delete all of the rows.  That was the intention.  I will look at the Truncate Table.  The link provided shows how to use that from the Python arcpy module but I am using Java ArcObjects and a quick search for that capability in ArcObjects didn't turn up anything.  I will look more on it though.  The issue though was not so much that the deleteSearchedRows was not working to delete all of the rows, it was more of an issue as to why it works okay when used against a file geodatabase that I own as compared to someone elses file geodatabase.  Because there were no errors and no rows were deleted, something must have gone wrong in the deleteSearchedRows black box somewhere but was not reported back as an error.  This is the mystery I am trying to solve.  Not sure if there is some way to turn on some ArcObjects debugging or if someone could verify that it is some kind of permissions thing.

0 Kudos
DuncanHornby
MVP Notable Contributor

Sounds, you've got it sorted.

You would run the truncate table via the geo-processor object. In fact you can run any of the system tools. Have a look at this thread, it has nothing to do with your problem but does show how you would use arcobjects to call any of the standard geo-processing tools.

0 Kudos
PeterLen
Occasional Contributor


Okay, I sort of solved it.  It must have been strictly a permissions issue.  I had been running the tests via Eclipse.  I decided to open Eclipse as an Administrator and all ran fine.  This seems odd though because if I run the application (as myself) and try to rename or delete an existing feature class table in a file GDB that someone else created, I get an "Access Denied" exception.  I would have expected the same behavior when deleting rows from a table given that it wouldn't delete the rows.  Maybe it wasn't an "access" issue but all I know is that it runs fine if I run the app as an Administrator.

0 Kudos