Select to view content in your preferred language

Delete Features and Attachements

818
14
12-19-2023 08:24 AM
kapalczynski
Occasional Contributor III

Which GeoProcessing Tool deletes all the Feature Class records and ALL the attachments?

0 Kudos
14 Replies
AlfredBaldenweck
MVP Regular Contributor

Assuming it's in a geodatabase, rather than AGOL, you want to use Truncate on both the feature class ("....gdb\exampleFc") and the attachment table ("....gdb\exampleFc__ATTACH") Note: There are two underscores before ATTACH

 

kapalczynski
Occasional Contributor III

OK so there is on tool that does both I have to address but the FC and Attach Table

 

Yes this is an enterprise GDB

 

0 Kudos
AlfredBaldenweck
MVP Regular Contributor

Yes, run it twice.

0 Kudos
kapalczynski
Occasional Contributor III

If I use Append ... does that add Features and Attachments back ?

0 Kudos
AlfredBaldenweck
MVP Regular Contributor

It depends.

Append would definitely work to add the features back in to your feature class.

Attachments are a little more complicated. Appending from another Attachment table would get the records in, but you'd manually have to change the relGlobalID to make them match.

Using the Add Attachments (and generate match table) tool is slower, but it works on attachments sitting in a folder.

0 Kudos
kapalczynski
Occasional Contributor III

Not really following the attachments part... 

Assuming the FC and Attachments in the target are EMPTY

  • Do I need to run a process to create the match table
  • Then append attachments using this table?

Not sure how that workflow works....

 

 

0 Kudos
AlfredBaldenweck
MVP Regular Contributor

To be honest, I'm not really sure what you're trying to accomplish here.

If you empty both tables, append in the features to the feature class.

From there, you have the following options:

  • Manually add attachments to each feature using the Attribute PaneAlfredBaldenweck_0-1703006496701.png
  • If you're trying to copy/paste attachments from another attachment table, you can just do that with Append, but you'll have to manually change the RELGLOBALID in the attachment table to actually make them correctly attach to the appropriate record in the feature class.
  • OR, if your new attachments live in a folder, run "Generate Match Table" using the feature class and said folder, then run "AddAttachments".
0 Kudos
kapalczynski
Occasional Contributor III
  • I have 2 FC and 8 tables in AGOL... with relationships
  • I have 2 FC and 8 Tables in Enterprise DB SDE ... with relationships
  • I need to get the data from AGOL into SDE including the Attachments while retaining GLOBALIDs with relationships
0 Kudos
kapalczynski
Occasional Contributor III

I have hundreds of attachments if not thousands... 

I dont understand this workflow

  • If you're trying to copy/paste attachments from another attachment table, you can just do that with Append, but you'll have to manually change the RELGLOBALID in the attachment table to actually make them correctly attach to the appropriate record in the feature class.
0 Kudos