* Help with query to list 1st cousins of selected person

Questions regarding use of any Version of Family Historian. Please ensure you have set your Version of Family Historian in your Profile. If your question fits in one of these subject-specific sub-forums, please ask it there.
Post Reply
avatar
kelvin
Silver
Posts: 9
Joined: 01 Oct 2005 00:42
Family Historian: V6.2

Help with query to list 1st cousins of selected person

Post by kelvin » 31 Jan 2021 16:33

I'm managed to write a custom query to list all first cousins of a specified person by adapting an existing query using the expressions:

Addif =Relationship(["Starting Person"],,TEXT,1) matches 'cousin'

& then excluding if they are not direct cousins (ie husband or wife of a cousin)

I don't consider it to be very elegant & think there may be a better way of doing it but it suffices for now.

But I've now quite stuck on modifying it to only have paternal cousins or maternal cousins not both - ie children of one's father's siblings & also of one's mother's siblings.

This can be 2 separate queries, although I suspect it could be in future combined into 1 by having a 2nd input parameter such as paternal or maternal or similar but, at present, that can wait.

And before anyone asks why I want such a list, Irish families can be HUGE and my wife has 89 first cousins and 77 of them are still alive ranging from age 52 to 85.

(And >4000 relatives and counting !!!)

I've had several attempts at it but with no success so I, & in particular my wife, would be so grateful for some help.

I've been using Family Historian for quite sometime, but only now in lockdown do I have the time to try to get to grips with it and produce more meaningful diagrams & reports. I've searched the help, tutorials & forums but still can't work out how to 'code' it even though I think it can't be that difficult.

So thanks in advance for any help any of you experts out there can give me

User avatar
tatewise
Megastar
Posts: 27088
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Help with query to list 1st cousins of selected person

Post by tatewise » 31 Jan 2021 17:49

I think the solution involves checking for a common grandparent family.

So consider the Starting Person's father's parent family.
If a cousin via either their father or mother has the same grandparent family then they are a paternal cousin.

The Starting Person's father's parent family is:
=Field( Individual( ["Starting Person"] ), 'INDI.~FATH>FAMC>' )

The cousin's father's and mother's grandparent families are:
%INDI.~FATH>FAMC>% and %INDI.~MOTH>FAMC>%

So to compare them to check if they are same use Add if expression is true for both:
=IsSameItem( Field( Individual( ["Starting Person"] ), 'INDI.~FATH>FAMC>' ), %INDI.~FATH>FAMC>% )
and
=IsSameItem( Field(Individual( ["Starting Person"] ), 'INDI.~FATH>FAMC>' ), %INDI.~MOTH>FAMC>% )

Finally, Exclude unless =Relationship( ["Starting Person"], , TEXT, 1 ) matches 'cousin'

The maternal case is the same except using =Field( Individual( ["Starting Person"] ), 'INDI.~MOTH>FAMC>' )

These all assume the natural birth parent families are the 1st FAMC.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
kelvin
Silver
Posts: 9
Joined: 01 Oct 2005 00:42
Family Historian: V6.2

Re: Help with query to list 1st cousins of selected person

Post by kelvin » 31 Jan 2021 18:03

Fantastic Mike

I was on the right track but I hadn't thought of comparing the Family but was looking at the individual grandparents.

I'm learning something new every day and I am so impressed with the help given by persons like yourselves on this forum. It really confirms my views all along that Family Historian is by far and away the best program for genealogy research. If only I could persuade my brother who persists in using Family Tree Maker !!!

User avatar
tatewise
Megastar
Posts: 27088
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Help with query to list 1st cousins of selected person

Post by tatewise » 31 Jan 2021 18:54

I think it would work comparing individual grandparents, but is unnecessary, and makes the data references longer.

Update the Starting Person's parent to prompt for FATH or MOTH and you can get either paternal or maternal cousins:

GetField( Individual( ["Starting Person"] ), "INDI.~" . ["FATH/MOTH"] . ">FAMC>" )
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
Jane
Site Admin
Posts: 8442
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Re: Help with query to list 1st cousins of selected person

Post by Jane » 01 Feb 2021 15:06

Another way to do this is use the Relationship codes.
A first cousin is always related 2 gens up and 2 gens down.

So
Add all Ancestors
Add all Descendants
Exclude unless =RelationCode(["Starting Person"],,GENS_UP,1) = 2
Exclude unless =RelationCode(["Starting Person"],,GENS_DOWN,1) = 2
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

User avatar
tatewise
Megastar
Posts: 27088
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Help with query to list 1st cousins of selected person

Post by tatewise » 01 Feb 2021 15:44

Yes, but Exclude unless =Relationship( ["Starting Person"], , TEXT, 1 ) matches 'cousin' is much neater & concise.
It was paternal versus maternal branch that he needed help with.

Anyway, the Expressions need enclosing IsTrue(...) like this:
=IsTrue(RelationCode(["Starting Person"],,GENS_DOWN,1) = 2)
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
Jane
Site Admin
Posts: 8442
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Re: Help with query to list 1st cousins of selected person

Post by Jane » 02 Feb 2021 09:30

> Anyway, the Expressions need enclosing IsTrue(...)

Actually it does not.
2021-02-02_092827.jpg
2021-02-02_092827.jpg (25.09 KiB) Viewed 1762 times
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

User avatar
tatewise
Megastar
Posts: 27088
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Help with query to list 1st cousins of selected person

Post by tatewise » 02 Feb 2021 11:27

Ah, yes! :oops:
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

Post Reply