# Family Nick name propagation

**URL:** <https://gramps.discourse.group/t/family-nick-name-propagation/1654>\
**Category:** Help\
**Tags:** name-editor, supertool-script\
**Created:** [July 19, 2021, 3:06pm UTC](https://gramps.discourse.group/t/family-nick-name-propagation/1654 "2021-07-19T15:06:25Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![rbhagava](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@rbhagava](https://gramps.discourse.group/u/rbhagava)\
**Post date:** [July 19, 2021, 3:06pm UTC](https://gramps.discourse.group/t/family-nick-name-propagation/1654/1 "2021-07-19T15:06:25Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![emyoulation](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/emyoulation/32/67_2.png) [@emyoulation](https://gramps.discourse.group/u/emyoulation)\
**Post date:** [July 19, 2021, 11:22pm UTC](https://gramps.discourse.group/t/family-nick-name-propagation/1654/2 "2021-07-19T23:22:10Z")

</div>

In many ways, this task looks similar to the [experiment performed with the Supertool](https://gramps.discourse.group/t/tree-vivisection-experiments-with-the-isotammi-supertool/1621).

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](https://gramps-project.org/wiki/index.php/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.

---

<div class="post-metadata">

**Author:** ![rbhagava](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@rbhagava](https://gramps.discourse.group/u/rbhagava)\
**Post date:** [July 21, 2021, 3:43pm UTC](https://gramps.discourse.group/t/family-nick-name-propagation/1654/3 "2021-07-21T15:43:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![emyoulation](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/emyoulation/32/67_2.png) [@emyoulation](https://gramps.discourse.group/u/emyoulation)\
**Post date:** [July 21, 2021, 4:04pm UTC](https://gramps.discourse.group/t/family-nick-name-propagation/1654/4 "2021-07-21T16:04:19Z")

</div>

Looking at the v4.1 [Gramps Data Model](https://gramps-project.org/wiki/index.php/Gramps_Data_Model) shows `famnick` rather than `familynick`

_[Our [benevolent dictator](https://www.gramps-project.org/wiki/index.php?title=5.2_Roadmap&mobileaction=toggle_view_desktop#Project_governance) 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.]_

---

<div class="post-metadata">

**Author:** ![rbhagava](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@rbhagava](https://gramps.discourse.group/u/rbhagava)\
**Post date:** [July 22, 2021, 8:44pm UTC](https://gramps.discourse.group/t/family-nick-name-propagation/1654/5 "2021-07-22T20:44:36Z")

</div>

Many thanks!! I was able to accomplish this without too much difficulty.

---

<div class="post-metadata">

**Author:** ![emyoulation](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/emyoulation/32/67_2.png) [@emyoulation](https://gramps.discourse.group/u/emyoulation)\
**Post date:** [July 22, 2021, 9:15pm UTC](https://gramps.discourse.group/t/family-nick-name-propagation/1654/6 "2021-07-22T21:15:56Z")

</div>

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.)

---

<div class="post-metadata">

**Author:** ![rbhagava](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@rbhagava](https://gramps.discourse.group/u/rbhagava)\
**Post date:** [July 22, 2021, 10:02pm UTC](https://gramps.discourse.group/t/family-nick-name-propagation/1654/7 "2021-07-22T22:02:32Z")

</div>

```
[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
```

---

<div class="post-metadata">

**Author:** ![emyoulation](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/emyoulation/32/67_2.png) [@emyoulation](https://gramps.discourse.group/u/emyoulation)\
**Post date:** [July 23, 2021, 1:04pm UTC](https://gramps.discourse.group/t/family-nick-name-propagation/1654/8 "2021-07-23T13:04:12Z")

</div>

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.)

---

<div class="post-metadata">

**Author:** ![emyoulation](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/emyoulation/32/67_2.png) [@emyoulation](https://gramps.discourse.group/u/emyoulation)\
**Post date:** [July 24, 2021, 3:45pm UTC](https://gramps.discourse.group/t/family-nick-name-propagation/1654/9 "2021-07-24T15:45:31Z")

</div>

Split this topic on July 24, 2021, 3:45pm UTC

5 posts were split to a new topic: [Hacking with Display formats for names](https://gramps.discourse.group/t/hacking-with-display-formats-for-names/1673)
