Hi,
Using GrampsAIO64-5.1.3-2 on Windows. I have some 600+ persons in my family tree. I recently added a Family nick name to the topmost ancestor in my family tree. The reason for this is that we don’t have enough real estate in the Charts/Reports to show my rather long surname. I was hoping that adding familynick will take effect and propagate that to all the descendants Unfortunately, it did not. Is there a way that the familynick can be pushed to all person records in my family?
In many ways, this task looks similar to the experiment performed with the Supertool.
Only, in addition to checking for a Patrilinal surname match, you would want to check for for the existence of a Family Nick Name. Then post that to the child’s Family Nick Name. (The SuperTool example posts data to the child’s primary name’s Origin.)
Test this on the EXAMPLE.GRAMPS not your live data. And once the script works on the example, make a backup before running a script on your main Tree.
Thank you very much for your guidance emyoulation. Appreciate it! Because I am a relative novice, I ask this… Where can I find the documentation for Surname object (and other objects that I can use in Gramps)? I guessed and coded get_familynick() to get the family nick name but shows as error.
Looking at the v4.1 Gramps Data Model shows famnick
rather than familynick
[Our benevolent dictator has noted that the v4.1 model is still viable documentation having only a minor change in PlaceName. But it will need updating for v5.2 due to more extensive Place model changes.]
Many thanks!! I was able to accomplish this without too much difficulty.
That’s great!
I you wanted to share, please post the script. The next person having to assign a Family Nickname to descendants won’t have to go through the full learning curve.
(And the script will be here if you switch machines but need it again. Just put a <pre> before the pasted text of the script and </pre> after.)
[title] set-FamilyNickname-to-abbreviation [category] Families [initial_statements] # SuperTool script for the Families category # # Goes through all children in the family and sets their # FamilyNickname to an abbreviated form if the child's # surname matches with father's surname # from gramps.gen.lib import NameOriginType counter = [0] def get_primary_surname(p): return p.obj.primary_name.get_primary_surname().surname def get_surnames(p): for nameobj in p.nameobjs: for surnameobj in nameobj.get_surname_list(): yield surnameobj [statements] father_surname = get_primary_surname(father) for c in children: for i, surnameobj in enumerate(get_surnames(c)): if surnameobj.get_surname() == father_surname: if surnameobj.get_surname() == "Snowden": c.obj.primary_name.set_family_nick_name("S") if surnameobj.get_surname() == "Parker": c.obj.primary_name.set_family_nick_name("P") if surnameobj.get_surname() == "Keys": c.obj.primary_name.set_family_nick_name("K") if surnameobj.get_surname() == "Hoag": c.obj.primary_name.set_family_nick_name("H") db.commit_person(c.obj, trans) counter[0] += 1 [filter] [expressions] "names updated:",counter[0] [scope] selected [unwind_lists] False [commit_changes] True [summary_only] True
Interesting. So, you are creating a Monogram placeholder for 4 core surname lines in your Tree by repurposing the Family Nickname. (I did not write “Initial” because in computer usages, this could be mistaken for a form of “initialization”, or setting of a default form/value,) I had mistaken the objective as populating the Tree with a commonly used Family Nickname.
I have not tried it, but I wonder if a customized Name Format (created in the Display tab of Preferences) of the “Display As:” might be an alternative approach. And one that could be applied en masse for a Surname.
It would require some experimenting. Because I suspect you would have to create 4 display format templates (since there isn’t an automatic Monogramming format). And I am not confident all Report/Chart features will apply the “Display As”. (The individual contributing programmers had varying familiarity with the Gramps name options… some may not have even realized that preformatting exists.)
5 posts were split to a new topic: Hacking with Display formats for names