SuperTool: help accessing Groups_as value

I’m trying to retreive the group_as value of grouped persons using SuperTool but ST returns me nothing.

I tried to get the content of that field:

Persons are well grouped, I don’t get any error from ST but displayed field is an empty string:

Any idea how to do that?

I think this is what you want.

[db.get_name_group_mapping(name.get_group_name()) for name in nameobjs]

I don’t know why group_as always returns an empty string instead of the expected group_as name. It seems you have to get it from a database table where surnames and group_as names are mapped.

1 Like

Thank you, that works well.

I like grouped persons to be sorted by their firstname but somtimes I need them to be sorted by their lastname so this script works now (-1 designate the firstname sort order I’ve designed in preferences):

[Gramps SuperTool script file]

Individus-Sort_as of grouped persons


sort_by_fn = True # By firstname -> True; By lastname -> False 

if sort_by_fn:
    sort_order = -1
    sort_order = 0

if "<<" in db.get_name_group_mapping(nameobjs[0].get_group_name()):
    for n in nameobjs:







(be careful, commit changes is set)

1 Like

Have you used the Isotammi add-ons: Name Editor tool… and Name Merge tool… ?

Even when not using them for their intended purpose (like merging all the uppercase “JOHN” instances into camelcase “John”), you can use them as quantified worklists of all the oddities that you want to manually harmonize.

And since they count the number of instances, you can decide which oddities are worth writing a SuperTool script.

There are two group_as functions, the first is specific to a particular name in the name.group_as object. This is set when a name is given a specific override, not as a part of the larger group, when set with the “Group this name only” in the “Group all people with the same name” dialog box that turns up when you set the Group as override.

The second group_as function appears when answering with “Group all” to the dialog, the db.get_name_group_mapping values are set since they apply to all the matching names.


No, but I don’t want to harmonize anything. I prefer to record names as they appear in sources, then if needed I group them into the same group.

@prculley I think I always used the “group all” option in my db, thereforce all “name.group_as” are empty. Now everthing makes sense. :grinning_face_with_smiling_eyes:


The types of Harmonization I’m talking about are definite data entry errors.

Like a “, Jr.” appended in the Given Name rather than the suffix field. Or worse, the floating “I” that has to be inspected one-by-one to see if it is the initial “I.” (appropriate for the Given Name) or eponym indicator (that should be a suffix)

I found a lot of nicknames in the example.gramps file that were incorrectly parenthesized or quoted in the Given Name too.

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