Moving Events to Names

I still have incorrect entries in my Gramps database that I’d like to move.
Perhaps this can be done with a @kku SuperTool script?

In my old genealogy program, I couldn’t enter different names. Not even the married name.
That’s why I created the married name as an event.
In Gramps, I’d like to have it listed as the married name under Alternative Names.
Is this possible with the SuperTool?
I work with Gramps 6.0 on Win11

Please provide a sample of how the data has been entered.

Such as a screen capture of an Event Editor with one of your Married name Events. A screen capture of the same Person Editor with the Name tab active.

Note that the thread Tree vivisection experiments with the Isotammi SuperTool has scripting examples of manipulating an existing Name entry. Including setting the Name type and the origin and validating those against the spouse and father.

And the wiki has links to a nice assortment of SuperTool scripts related to Names. (The section with @PLegoux scripts has some interesting scripts too, Including re-ordering of Alternative Names.)

1 Like

There’s another July 2024 thread (How do we harmonize custom data with a new standard feature) with a similar issue.
It hasn’t progressed to writing a script. But sharing progress on a script for this “Event → Alternative Name” conversion would help it too.

Its issue is about is about migrating/harmonizing data from Custom Attributes to a Role in a Shared Event.

1 Like

Here is the screenshot of the event " Ehename der Frau - Wife’s Married Name"

I would like to move this entry here.

1 Like

Since I don’t know anything about SuperTool, I wanted to do it with a mouse recorder. Unfortunately, it somehow doesn’t recognize Gramps’ individual windows.
Then maybe I’ll find another way…

Here is a quick-and-dirty Supertool script for this:

[Gramps SuperTool script file]
version=1

[title]
move_events_to_names

[description]

[category]
Families

[initial_statements]
def move_name(newname, person):
	name = Name()
	name.set_type(NameType.MARRIED)
	surname = Surname()
	surname.set_surname(newname)
	name.add_surname(surname)
	namelist = person.get_alternate_names()
	namelist.append(name)
	db.commit_person(person, trans)

count = 0

[statements]
for e in events:
	if e.type == "Ehename der Frau":
		move_name(e.description, mother.obj)
		count += 1

[filter]

[expressions]
"Names moved:", count

[scope]
selected

[unwind_lists]
False

[commit_changes]
False

[summary_only]
True

This will not delete the original events. After running this you should delete the events in the Events view.

I hope this helps.

3 Likes

Nice!

I wonder if more information is contained in the Event that might also need to be moved?

Such as: an “After” date range for the Alternate name, an origin (Taken), name type (Married) already supported, secondary objects (Sources, Notes, Media)

That’s why I asked for a sceen captured sample.

It is interesting that a Family Event was chosen. That provides a little extra context.

Kari, I owe you thanks again.
Can I also add the date and source to the names?
It’s not visible in the screenshot.
Is that possible?

This version includes the date and source citations:

[Gramps SuperTool script file]
version=1

[title]
move_events_to_names

[description]

[category]
Families

[initial_statements]
def move_name(event, person):
	newname = event.description
	name = Name()
	name.set_type(NameType.MARRIED)
	name.set_date_object(event.get_date_object())
	name.set_citation_list(event.get_citation_list())
	surname = Surname()
	surname.set_surname(newname)
	name.add_surname(surname)
	namelist = person.get_alternate_names()
	namelist.append(name)
	db.commit_person(person, trans)

count = 0

[statements]
for e in events:
	if e.type == "Ehename der Frau":
		move_name(e.obj, mother.obj)
		count += 1

[filter]

[expressions]
"Names moved:", count

[scope]
selected

[unwind_lists]
False

[commit_changes]
False

[summary_only]
True

4 Likes

Thank you so much for your help, Kari. You’re really very kind…

:smiling_face_with_three_hearts: :smiling_face_with_three_hearts:

1 Like

Kari, I’m sorry. But I get an error message when I run it. What am I doing wrong?

The first line in “Statements” should be

for e in events:

The final ‘s’ seems to be missing.

1 Like

Then this error message appears. That’s why I removed the s.

OK, I’m sorry. The script should be run in the Families view. I forgot to mention that.

1 Like

It worked. Thank you very much and you don’t have to apologize to me.

Happy Easter!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.