Delete of non related individuals

Quote from chiptobey1 on 2020-12-28, 7:12 pmI have a rather large file I got handed that has valuable information but it also has lots (1000s) of individuals that are nor related and I want to delete. Any one have either a delete of individuals that are not identified as relatives after setting the relationships or assign them to a group to aid in deletion?
I have a rather large file I got handed that has valuable information but it also has lots (1000s) of individuals that are nor related and I want to delete. Any one have either a delete of individuals that are not identified as relatives after setting the relationships or assign them to a group to aid in deletion?

Quote from GlenB on 2020-12-28, 8:15 pmThat's a mess I've somehow managed to handle, but I have no one step SQL script to do it. One thing that will help is the PersonTable.relate1 and .relate2 fields. If (relate1+relate2)>0 then there is a relation to your base person. But you probably don't want to delete everyone where it = 0 because that also loses all the spouses of related people. Maybe you can do something with creating groups of people and setting the color on them and then deleting people with color=something and relate1+relate2=0? Someone smarter than me might be able to put that together for you!
Once you're done though, don't forget to run DeletePhantom3 script from this website and then use the RM tools to clean up and reindex the database.
That's a mess I've somehow managed to handle, but I have no one step SQL script to do it. One thing that will help is the PersonTable.relate1 and .relate2 fields. If (relate1+relate2)>0 then there is a relation to your base person. But you probably don't want to delete everyone where it = 0 because that also loses all the spouses of related people. Maybe you can do something with creating groups of people and setting the color on them and then deleting people with color=something and relate1+relate2=0? Someone smarter than me might be able to put that together for you!
Once you're done though, don't forget to run DeletePhantom3 script from this website and then use the RM tools to clean up and reindex the database.

Quote from thejerrybryan on 2020-12-28, 9:12 pmIt's straightforward from within RM to make a group or to color code based in people being in the same tree as you are not being in the same tree as you. If you were going to do a bulk delete with SQLite, I think the best place to start is to create such a group or color code and then do your bulk delete based on that. It's much easier to make the selection of who to delete in RM than it is in SQLite, and then let SQLite do the bulk delete part.
It's straightforward from within RM to make a group or to color code based in people being in the same tree as you are not being in the same tree as you. If you were going to do a bulk delete with SQLite, I think the best place to start is to create such a group or color code and then do your bulk delete based on that. It's much easier to make the selection of who to delete in RM than it is in SQLite, and then let SQLite do the bulk delete part.

Quote from chiptobey1 on 2021-01-01, 12:56 pmThanks for you comments. This is what I ended up doing. I used RM to set relationships. With your comments I understood that I would be missing spouses so I used SQLLITE and the familytable. I looked at fathers that were marked as relatives and ensured that mothers (wifes) had a value set in relate1. I used 111. I just wanted something that could be tested. I did the reverse for setting fathers.
That allowed me to delete any person with relate1 and relate2 with a value of 0. As a cleanup, I deleted names that didn't have a person, deleted events without a person and then places that didn't have event.
It gave me the result I wanted. Thanks for your thoughts.
Thanks for you comments. This is what I ended up doing. I used RM to set relationships. With your comments I understood that I would be missing spouses so I used SQLLITE and the familytable. I looked at fathers that were marked as relatives and ensured that mothers (wifes) had a value set in relate1. I used 111. I just wanted something that could be tested. I did the reverse for setting fathers.
That allowed me to delete any person with relate1 and relate2 with a value of 0. As a cleanup, I deleted names that didn't have a person, deleted events without a person and then places that didn't have event.
It gave me the result I wanted. Thanks for your thoughts.

Quote from Tom Holden on 2021-01-03, 11:45 pmI would have used Jerry's strategy:
- Count Trees and identify a person in each unwanted tree.
- Clear color codes.
- Color code red everyone in the same tree as each of the people identified in 1.
- Use the bulk delete script at Delete Many #delete.
- Run the File > Database Tools
Of course, you would have made a backup of your database file in case you are not happy with the outcome. Only step #4 requires a SQLite manager; the rest are in RM.
I would have used Jerry's strategy:
- Count Trees and identify a person in each unwanted tree.
- Clear color codes.
- Color code red everyone in the same tree as each of the people identified in 1.
- Use the bulk delete script at Delete Many #delete.
- Run the File > Database Tools
Of course, you would have made a backup of your database file in case you are not happy with the outcome. Only step #4 requires a SQLite manager; the rest are in RM.