2023-02-19 Version for #RM8 added.
- Creates a Named Group in the open database with the name “SQL: Duplicate Events” if one does not already exist
- Removes all members from that named group
- Populates that named group with persons having “duplicate” events
Duplication is declared if a pair of events:
- (have dates for which the span of calendar years (ignoring month and day) is less than a parameter (2 in the script) OR
- do not have dates but are fact types that use dates) AND (are both set or both not set as Primary events)
Duplication is resolved in RM by:
- deleting an event (you may want to incorporate an alternative date in the date or notes of the remaining event) OR
- setting one event only of the pair as Primary
To refresh the named group’s membership list to reflect corrections you may have made to resolve duplication of events, rerun the query to regenerate the RootsMagic group table and then, in RootsMagic, select a different group and then re-select the “SQL: Duplicate Events” group. You should see that names have disappeared from the group, provided you have corrected all the duplicate events for each person you worked on. The Quick Groups feature in RM7 and the Groups list in RM8 allow you to unmark a member from the group right from the Edit Person screen making it unnecessary to rerun the script unless you missed doing so.
To vary the parameter controlling how sensitive the query is to date differences, change this line at the end of the script:
WHERE ABS(SUBSTR(Date1,4,4) - SUBSTR(Date2,4,4)) <2 -- this controls how tight the year match must be. -- in future, the date comparison could call on a date calculator that could compute the difference in days ) ; --END of SCRIPT
A setting of “<2” permits two consecutive years which allows Dec 31, 1900 and Jan 1, 1901 to be considered duplicates as it does for Jan 1, 1900 and Dec 31, 1901. A setting “<1” requires the events to be in the same year.
Group-PersonsWithDuplicateEvents.sql rev 2018-07-07 bug fixed when no other existing group
RM8 Version 2023-02-19
Is there a version for release 8? I really need this. Thanks
Now there is!
Hate to bother you again but it appears a tweak is needed for version 9. Could you please look at? Thanks
@chiptobey1, Please be specific. Might be better to discuss in the Forum, rather than here. More fully featured editor.
Hi,
Can you advise if changes are required to run this script on RM10, please ?
“,PersonID AS” lines below are highlighted in Red.
“Column PersonalID not found” message…
Thanks
— Add members to the named group
INSERT INTO GroupTable
SELECT
null
,(SELECT TagValue
FROM TagTable
WHERE TagName
LIKE ‘SQL: Duplicate Events’
)
,PersonID AS StartID
,PersonID AS EndID
,(julianday(‘now’) – 2415018.5) AS UTCModDate
The RM8 version runs without SQLite error on a RM10 database I tested.
The error message you quote, if copied correctly, shows that there is a typo in the script you ran. There is no column “PersonalID” anywhere in the database. The correct name is “PersonID”.
Thanks Tom.
Working now.
Cheers