Delete all ancestors and events related to a specific person

I’m preparing a family tree for export for a project, and there’s some research/individuals that I don’t want included.

How can I delete all ancestors, events, etc. related to a specific person? In this way I want to “prune the tree” of unneeded branches, so to speak.

The easiest way is to create a filter to select all ancestors of the person, and then remove these by selecting all in the person view, and let Gramps delete them. If you do that, the associated events etc. are still in the database, but you can remove those by using a tool that removes all unrelated objects.

You need to be careful with this, because the standard ancestor filter includes the selected person too, and you may not want to remove that person. There are filters that allow you to exclude that person.

There is another danger in this approach, and that’s when some of the ancestors are your ancestors too, like for my ex girlfriend. We’re 7th cousins, so some of her ancestors are my ancestors too.

Thanks for the reply. Indeed, I wouldn’t want to remove the person I’m selecting, only the ancestors of them. Which filter option are you referring to that I should take a look at there?

You can also mark all them as private manually if you are not going export them in the future. I have one such branch which I received from another researcher who doesnt want make his tree public at the moment. So, all his tree (it only one branch in my tree) is private in my tree. Maybe this is your case

1 Like

When you create the filter, you can see that option right away, as decribed in this paragraph on the wiki:

https://gramps-project.org/wiki/index.php/Gramps_5.2_Wiki_Manual_-_Filters#Ancestral_filters

I often use standard filters for exports, where the ancestor filter always includes the selected person, but when you create a filter in the person view, the option is there.

1 Like

I’ll give both these solutions a try… thanks, both!

I think I found a (partial) solution which satisfies what I’m looking for, but I need some help with getting it over the finish line.

I found that the filters were still removing some people that I didn’t want, so instead what I did was broke the family connection in a few places, so that it’s not possible to explore the tree further.

Now, is there a way to export people based on a rule similar to “export all people and events that are connected through a traceable line?” This would ensure that the “pruned” parts which are sitting off on their own are not exported.

this is possible to make via filters, but it looks a bit difficult. You need create deep-nested filters with the next logic:
Iteration 1:

  1. get any person by id from a branch which you need to export
  2. get all spouses, descendants, ancestors, siblings of people from step 1)
  3. filter some people from step 2 who is connected to another branches
    Now you need repeat steps 1-3 using results from Iteration 1. You need duplicate all the filters above.
    More iterations - more full branch. I use up to 6 iterations for me.

Maybe abybody knows more easy way.

Yes, there is. You can create a person filter that selects all persons that are related to you, or another home person, where related means that these are connected by ancestry, marriage, and so forth. Some filters may also include associations between persons, and person links in notes, so you may need to experiment a but to get things right.

This works, because on export, you can apply any person filter that you have in your settings. And while you’re doing that, you can also ask Gramps to calculate the number of exported persons before you start the actual export, and check whether you see the same number as in the filtered person view.

And if yoo do this, please make sure to set the option at the bottom of the export window so that only data linked to these persons will be exported, because if you don’t, the export will still add all notes and sources, and other things, and you probably don’t want those.

Thanks for the tips. I’m looking at the export options, and I’m assuming I need to set up my own filter which is a combination of a few different rules?

I wonder if you wouldn’t mind describing this part of your response a bit more in depth: “You can create a person filter that selects all persons that are related to you, or another home person, where related means that these are connected by ancestry, marriage, and so forth.”

Here’s an example from my tree in 5.1:

The filter is one of the Relationship filters (you guessed that), and it includes all persons that have some connection to me, so it’s perfect when I have some isolated branches that I don’t want to include in the export, which can then be done like this:

I clicked the Calculate Previews button to see the actual number of people that will be exported. This works for all export formats.

Thank you very much for the hand-holding!

Unfortunately, I continue to run into a crash when I try to export my data using this method. It only happens if I change the reference filter to “do not include records not linked to a selected person.” I’ll report the crash using the tracker, but here it is for reference:

24975411: ERROR: grampsapp.py: line 174: Unhandled exception
Traceback (most recent call last):
  File "C:\Users\*****\AppData\Local\GrampsAIO64-5.1.6\gramps\gui\plug\export\_exportoptions.py", line 262, in preview
    self.preview_dbase = self.get_filtered_database(self.dbstate.db, pm, preview=True)
  File "C:\Users\*****\AppData\Local\GrampsAIO64-5.1.6\gramps\gui\plug\export\_exportoptions.py", line 570, in get_filtered_database
    dbase = self.apply_proxy(proxy_name, dbase, progress)
  File "C:\Users\*****\AppData\Local\GrampsAIO64-5.1.6\gramps\gui\plug\export\_exportoptions.py", line 644, in apply_proxy
    all_people=True)
  File "C:\Users\*****\AppData\Local\GrampsAIO64-5.1.6\gramps\gen\proxy\referencedbyselection.py", line 86, in __init__
    self.process_object(obj_type, handle, reference)
  File "C:\Users\*****\AppData\Local\GrampsAIO64-5.1.6\gramps\gen\proxy\referencedbyselection.py", line 127, in process_object
    obj = self.db.get_citation_from_handle(handle)
  File "C:\Users\*****\AppData\Local\GrampsAIO64-5.1.6\gramps\gen\db\generic.py", line 1288, in get_citation_from_handle
    return self._get_from_handle(CITATION_KEY, Citation, handle)
  File "C:\Users\*****\AppData\Local\GrampsAIO64-5.1.6\gramps\gen\db\generic.py", line 1270, in _get_from_handle
    raise HandleError('Handle %s not found' % handle)
gramps.gen.errors.HandleError: Handle f56465bc00c45f62f889e5695e not found

H’m, weird. Have you run check & repair recently?

I remember seeing similar things, when people had the privacy filter on, when exporting. And that came, because some part of the code assumed that some object existed, and couldn’t handle the fact that the privacy filter blocked access.

You didn’t mention this, but might it be that you have that filter on?

P.S. in this case, it might be about a private citation.

There is a chance that this was cured in a more recent version. Would you be willing to try that?

I tried the following things:

  1. Ran check and repair - a few minor issues, but nothing major.
  2. I don’t have the privacy filter on.
  3. I upgraded to the latest Gramps and tried again, but unfortunately the error persists.

The other frustrating part is that it seems to be impossible to full out a bug report because it’s not possible to select the Gramps project on the bug reporting page: Select Project - Gramps - Bugtracker – Free Genealogy Software
I even tried in other browsers and with another user - but no luck.

I tried it here too, and I can select the project, with Firefox. The screen is a bit deceptive, because the menu seems to be greyed out, but it works when I test it.

If you want, I can try the export with the debugger on, if you can send me a copy of the problem database in some form, like a zipped version of its Windows database folder. You can use the Info button to figure out which folder that is, and share it via OneDrive, or another cloud service that you trust, which can be private if you send the link via a PM on this forum.

1 Like

You must be logged in to select a project on that page. Although if you’re not logged in, I’m curious how you landed on that page…

1 Like

That’s the page that you’re taken to when reporting a bug in Gramps. In the window, the first button is “copy to clipboard,” and the second button opens a browser on that page.

I think it might be preventing a lot of users from reporting bugs (just a guess) - and I have yet to see why I can’t select anything in the dropdown. Maybe it’s an adblocker, but I’d be surprised.

Thanks for the info.

As far as I can tell using browser debug tools (F12 in most browsers) it is related to being logged in. When not logged in, the code for the page shows the choices being “disabled”. After logging in, the choices are no longer tagged disabled in code.

Tagging @sam888 - has anything changed recently regarding this flow that would cause the project choices to be disabled when not logged in?

1 Like

I think something might have reverted in the MantisBT settings.

The security token timeouts problem is back… and in a big way. I lost 3 sessions of data in less than a hour due to token timeouts.

2 Likes