* Widowed

Older V4 Queries please post for any version in the General Forum
Locked
avatar
Katja
Gold
Posts: 14
Joined: 21 Nov 2011 11:29
Family Historian: None

Widowed

Post by Katja » 25 Nov 2011 23:33

In my text scheme I have a custom item to show a marriage status and where a couple is divorced it shows 'Married (and Divorced): XY, Date of marriage'. Now I would like to incoroporate in existing text scheme a code for widowed people so that it would say: 'Married (Widowed): XY, Date of marriage' or, for umarried couples 'Unmarried Couple (Widowed): XY'. I was thinking that it should be a condition that if a person does not have Death event and their spouse does (for every dead person I created Death event), then it should write the text.

The existing text scheme is (I just adjusted the one I found in forum):

=TextIf(IsEmpty(%INDI.FAMS[1+]>_STAT%),ExistsText(%INDI.~SPOU[1+]>%,'Married'),TextIf(%INDI.FAMS[1+]>_STAT% = 'Divorced','Married (and Divorced)',%INDI.FAMS[1+]>_STAT%)): %INDI.~SPOU[1+]>%, %INDI.FAMS[1+]>MARR.DATE:COMPACT%, (Div: %INDI.FAMS[1+]>DIV.DATE:COMPACT%)

First I tried to write a condition so that it would only write 'Widowed' somewhere in the box:

TextIf(NotExists(%INDI.DEAT%) and Exists(%INDI.~SPOU>DEAT%)), 'Widowed','')

Well, it doesn't work [confused] It selects couples with one dead spouse, but it writes a mess and it is written in both boxes.

I am trying hard to learn about expressions, but these are to complex for me. I hope you cold help me like the last time I had a problem.

Katja

ID:5596

User avatar
PeterR
Megastar
Posts: 1129
Joined: 10 Jul 2006 16:55
Family Historian: V7
Location: Northumberland, UK

Widowed

Post by PeterR » 25 Nov 2011 23:55

One problem is that NotExists is not a valid function in FH.  The following expression, which instead uses IsEmpty, may provide what you need:

Code: Select all

=TextIf(IsEmpty(%INDI.DEAT%) and Exists(%INDI.~SPOU>DEAT%),'Widowed','')
Peter Richmond (researching Richmond, Bulman, Martin, Driscoll, Baxter, Hall, Dales, Tyrer)

avatar
Katja
Gold
Posts: 14
Joined: 21 Nov 2011 11:29
Family Historian: None

Widowed

Post by Katja » 26 Nov 2011 07:15

Thank you, Peter! It makes sense.
Now my question is how to incorporate your sollution in the main formula - to be connected with marriage status. To be honest, my main problem is, that I don't understand the formula (the complicated one)- why is written the way it is. I tried to analyze it but I got lost. So none of the things I did, didn't work.

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

Widowed

Post by tatewise » 26 Nov 2011 10:57

The concept of Widowed needs a little more thought.

In your database Events occur on different Dates.
So any one Individual at different Dates may be Unmarried, Married, Divorced, Widowed, Dead, etc.
It just depends upon what Date in their life you are considering.

So an Individual does not have a status of Widowed, but can have a Date on which they became Widowed.
Your condition IsEmpty(%INDI.DEAT%) and Exists(%INDI.~SPOU>DEAT%) only applies if you have not entered a Death Date for one of the Spouses.
But eventually you will enter their Death Date and then the condition will fail.
However, they were still Widowed at the Death Date of their Spouse.

So the expression needed is more like:
=TextIf((%INDI.DEAT.DATE% > %INDI.~SPOU>DEAT.DATE%),Text('Widowed: ' . %INDI.~SPOU>DEAT.DATE%),'')
This compares the Death Dates of the Spouses and reports the Widowed: Date for the widow(er).

However, that does not allow for missing Dates so you need:
=TextIf((%INDI.DEAT.DATE% > %INDI.~SPOU>DEAT.DATE%) or (IsEmpty(%INDI.DEAT.DATE%) and Exists(%INDI.~SPOU>DEAT.DATE%)),Text('Widowed: ' . %INDI.~SPOU>DEAT.DATE%),'')
This adds the condition or (IsEmpty(%INDI.DEAT.DATE%) and Exists(%INDI.~SPOU>DEAT.DATE%).

We are still not done, because there may be more than one Spouse and the Individual may be Widowed twice, so after the above expression you need:
=TextIf((%INDI.DEAT.DATE% > %INDI.~SPOU[2]>DEAT.DATE%) or (IsEmpty(%INDI.DEAT.DATE%) and Exists(%INDI.~SPOU[2]>DEAT.DATE%)),Text(' & ' . %INDI.~SPOU[2]>DEAT.DATE%),'')
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
Katja
Gold
Posts: 14
Joined: 21 Nov 2011 11:29
Family Historian: None

Widowed

Post by Katja » 26 Nov 2011 21:49

Thank you, tatewise, you are very kind to help me so much! However, this is still not the way I'd like it to be…

It is good point that when I enter the Death Date the condition falls. I haven't thought of that.

But I would like to incorporate something like your idea in formula which describes marriage status:

=TextIf(IsEmpty(%INDI.FAMS[1+]>_STAT%),ExistsText(%INDI.~SPOU[1+]>%,'Married'),TextIf(%INDI.FAMS[1+]>_STAT% = 'Divorced','Married (and Divorced)',%INDI.FAMS[1+]>_STAT%)): %INDI.~SPOU[1+]>%, %INDI.FAMS[1+]>MARR.DATE:COMPACT%, (Div: %INDI.FAMS[1+]>DIV.DATE:COMPACT%)

Example of person who married three times and his second spouse died:

Married (and Divorced): XY, 1965 (Div: 1970) .... the formula above covers this and the third line
Married (and Widowed): TZ, 1985 (Wid: 1991) .... this is what I'm looking for
Married: NM, 1998

Or:
Married (and Divorced): XY, 1965 (Div: 1970)
Unmarried Couple (and Widowed): TZ, 1985 (Wid: 1991)  .... this is what I'm looking for
Married: NM, 1998

In any case the formula above must be used, I believe.

Three things bother me:
-      where to put the condition (and most of all – how to write it) in the formula?
-      it should cover also Unmarried Couples (the way your sollution does)
-      if the person who died is Divorced and their first Spouse is still alive, in their box should NOT be written widowed (in PeterR's and your suggestion it does)

I know I ask a lot, but I am playing with ideas for some time now and I haven't found a sollution by myself.

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

Widowed

Post by tatewise » 27 Nov 2011 00:21

The combined expression for what you want is too long and complex for FH Text Schemes to handle.
I have tried various techniques and the only one that works requires several items for each marriage/partnership.

For marriage/partnership 1 enter the following three text scheme items and in the Div1 and Wid1 items untick the Start on New Line option:

Code: Select all

Mar1: =TextIf(IsEmpty(%INDI.FAMS>_STAT%) or (%INDI.FAMS>_STAT% = 'Divorced'),ExistsText(%INDI.~SPOU>%,Text('Married: ' . %INDI.~SPOU>% . ', ' . %INDI.FAMS>MARR.DATE:COMPACT%)),Text(%INDI.FAMS>_STAT% . ': ' . %INDI.~SPOU>% . ', ' . %INDI.FAMS>MARR.DATE:COMPACT%))
Div1: =TextIf(%INDI.FAMS>_STAT% = 'Divorced',Text('(Div: ' . %INDI.FAMS>DIV.DATE:COMPACT% . ')'),)
Wid1: =TextIf(Not(%INDI.FAMS>_STAT% = 'Divorced') and ((%INDI.DEAT.DATE% > %INDI.~SPOU>DEAT.DATE%) or (IsEmpty(%INDI.DEAT.DATE%) and Exists(%INDI.~SPOU>DEAT.DATE%))),Text('(Wid: ' . %INDI.~SPOU>DEAT.DATE:COMPACT% . ')'),)
For marriage/partnership 2 enter the following three similar text scheme items that only differ by inserting the index [2] where necessary:

Code: Select all

Mar2: =TextIf(IsEmpty(%INDI.FAMS[2]>_STAT%) or %INDI.FAMS[2]>_STAT% = 'Divorced',ExistsText(%INDI.~SPOU[2]>%,Text('Married: ' . %INDI.~SPOU[2]>% . ', ' . %INDI.FAMS[2]>MARR.DATE:COMPACT%)),Text(%INDI.FAMS[2]>_STAT% . ': ' . %INDI.~SPOU[2]>% . ', ' . %INDI.FAMS[2]>MARR.DATE:COMPACT%))
Div2: =TextIf(%INDI.FAMS[2]>_STAT% = 'Divorced',Text('(Div: ' . %INDI.FAMS[2]>DIV.DATE:COMPACT% . ')'),)
Wid2: =TextIf(Not(%INDI.FAMS[2]>_STAT% = 'Divorced') and ((%INDI.DEAT.DATE% > %INDI.~SPOU[2]>DEAT.DATE%) or (IsEmpty(%INDI.DEAT.DATE%) and Exists(%INDI.~SPOU[2]>DEAT.DATE%))),Text('(Wid: ' . %INDI.~SPOU[2]>DEAT.DATE:COMPACT% . ')'),)
For marriage/partnership 3 enter three similar text scheme items but replace [2] with [3] throughout.
If anyone has four or more spouses then continue with [4] and [5] as necessary.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
Katja
Gold
Posts: 14
Joined: 21 Nov 2011 11:29
Family Historian: None

Widowed

Post by Katja » 27 Nov 2011 23:00

tatewise, you trully are an expert! May I ask you just for one 'upgrade'? Is it possible in Mar: section to avoid the comma at the end of a person's name - just where I have no Marriage Date?

For not displaying comma after Unmarried Couples, I deleted the last part, now it is:
=TextIf(IsEmpty(%INDI.FAMS>_STAT%) or (%INDI.FAMS>_STAT% = 'Divorced'),ExistsText(%INDI.~SPOU>%,Text('Married: ' . %INDI.~SPOU>% . ', ' . %INDI.FAMS>MARR.DATE:COMPACT%)),Text(%INDI.FAMS>_STAT% . ': ' . %INDI.~SPOU>% ))

Can TextIf function be inside Text function at all? I tried to replace ',' with following, but it didn't work (the function itself is valid):
TextIf(Exists(INDI.FAMS>MARR.DATE:COMPACT), ' , %INDI.FAMS>MARR.DATE:COMPACT%', ' ')

I hope I will not bother you again!

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

Widowed

Post by tatewise » 28 Nov 2011 11:12

First a little explanation for why this does not work:
TextIf(Exists(INDI.FAMS>MARR.DATE:COMPACT), ' , %INDI.FAMS>MARR.DATE:COMPACT%', ' ')
This Template is valid only because it is plain text and not a Function.
If you OK out of the Text Scheme you will see the boxes just contain your Template text.
When entered on its own the first Function must be prefixed with an equals = sign, e.g. =TextIf(...) then when you use Test it will be invalid.
The Exists function needs its DATE Data Reference enclosed in percent % signs, e.g. Exists(%INDI.FAMS>MARR.DATE%).
The comma ', ' text and DATE Data Reference must be joined in a Text function, e.g. Text(', ' . %INDI.FAMS>MARR.DATE:COMPACT%).

For more more advice see the Knowledge Base under Family Historian - Advanced Guide:
Understanding Data References http://www.fhug.org.uk/wiki/doku.php?id ... references
Understanding Functions http://www.fhug.org.uk/wiki/doku.php?id ... _functions

The complete Template therefore becomes:
=TextIf(Exists(%INDI.FAMS>MARR.DATE%),Text(', ' . %INDI.FAMS>MARR.DATE:COMPACT%),'')

When inserted into the Mar#: items, drop the equals = sign to give:

Code: Select all

Mar1: =TextIf(IsEmpty(%INDI.FAMS>_STAT%) or (%INDI.FAMS>_STAT% = 'Divorced'),ExistsText(%INDI.~SPOU>%,Text('Married: ' . %INDI.~SPOU>% . TextIf(Exists(%INDI.FAMS>MARR.DATE%),Text(', ' . %INDI.FAMS>MARR.DATE:COMPACT%),''))),Text(%INDI.FAMS>_STAT% . ': ' . %INDI.~SPOU>%))
Mar2: =TextIf(IsEmpty(%INDI.FAMS[2]>_STAT%) or (%INDI.FAMS[2]>_STAT% = 'Divorced'),ExistsText(%INDI.~SPOU[2]>%,Text('Married: ' . %INDI.~SPOU[2]>% . TextIf(Exists(%INDI.FAMS[2]>MARR.DATE%),Text(', ' . %INDI.FAMS[2]>MARR.DATE:COMPACT%),''))),Text(%INDI.FAMS[2]>_STAT% . ': ' . %INDI.~SPOU[2]>%))
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
normandowns
Gold
Posts: 22
Joined: 26 Apr 2003 00:04
Family Historian: V7

Widowed

Post by normandowns » 28 Nov 2011 17:03

I have been following this with interest, and wonder if you could explain how to add the Short Place Name after the Marriage Date?

I have tried and failed miserably!

Regards, Norman

User avatar
PeterR
Megastar
Posts: 1129
Joined: 10 Jul 2006 16:55
Family Historian: V7
Location: Northumberland, UK

Widowed

Post by PeterR » 28 Nov 2011 17:32

In Tatewise's excellent expression above, the =Text function is used with the 'dot' operator to concatenate two items:

Code: Select all

Text(', ' . %INDI.FAMS>MARR.DATE:COMPACT%)
It is merely necessary to edit the expression so that the same =Text function has two additional items also concatenated by 'dot's, as follows:

Code: Select all

Text(', ' . %INDI.FAMS>MARR.DATE:COMPACT% . ', ' . %INDI.FAMS>MARR.PLAC:SHORT%)
Note that when used as an argument of another function, the equals sign must be omitted, as shown.
Peter Richmond (researching Richmond, Bulman, Martin, Driscoll, Baxter, Hall, Dales, Tyrer)

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

Widowed

Post by tatewise » 28 Nov 2011 17:38

Immediately after wherever DATE:COMPACT% appears, insert the following:

Code: Select all

 ' ' . %INDI.FAMS>MARR.PLAC:SHORT%
There must be a space between DATE:COMPACT% and ' ' .

Add an index [2] or [3] to FAMS e.g. FAMS[2]> for the 2nd and 3rd families.

I have not included any visible characters within the ' ' in case there is no Place defined at all.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
normandowns
Gold
Posts: 22
Joined: 26 Apr 2003 00:04
Family Historian: V7

Widowed

Post by normandowns » 28 Nov 2011 18:23

That's just what I was trying, but the Place Name doesn't show up.

There is definitely a place name in the record, as I have a line showing

Code: Select all

Marr:   %INDI.FAMS[1+]>MARR.DATE:ABBREV% %INDI.FAMS[1+]>MARR.PLAC:SHORT%
and that works ok.

Norman

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

Widowed

Post by tatewise » 28 Nov 2011 18:34

You must be very precise with the inserted code and check it by clicking the Test button.

Your code uses the [1+] index which loops through all the families.
Whereas, in all the examples above the index only refers to one family at a time.
If there is no index then the first family is referenced.

Might any of that explain why your code does not work?

Please post a copy of your Template Code here for us to investigate further.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
normandowns
Gold
Posts: 22
Joined: 26 Apr 2003 00:04
Family Historian: V7

Widowed

Post by normandowns » 28 Nov 2011 18:49

The code I am using is

Code: Select all

=TextIf(IsEmpty(%INDI.FAMS>_STAT%) or (%INDI.FAMS>_STAT% = 'Divorced'),ExistsText(%INDI.~SPOU>%,Text('Married: ' . %INDI.~SPOU>% . ', ' . %INDI.FAMS>MARR.DATE:COMPACT%)),Text(%INDI.FAMS>_STAT% . ': ' . %INDI.~SPOU>% . ', ' . %INDI.FAMS>MARR.DATE:COMPACT% . ', ' . %INDI.FAMS>MARR.PLAC:SHORT%)) 
It tests ok, but there is no place name showing.

Norman

User avatar
PeterR
Megastar
Posts: 1129
Joined: 10 Jul 2006 16:55
Family Historian: V7
Location: Northumberland, UK

Widowed

Post by PeterR » 28 Nov 2011 19:15

As Tatewise said above:
Immediately after wherever DATE:COMPACT% appears, insert the following:
code:
' ' . %INDI.FAMS>MARR.PLAC:SHORT%
I think you need to do this for the first occurrence of DATE:COMPACT%, as well as the second.
Peter Richmond (researching Richmond, Bulman, Martin, Driscoll, Baxter, Hall, Dales, Tyrer)

User avatar
normandowns
Gold
Posts: 22
Joined: 26 Apr 2003 00:04
Family Historian: V7

Widowed

Post by normandowns » 28 Nov 2011 19:19

Many thanks - that's what comes of copying and pasting - I hadn't even notice it was there twice.

Norman

avatar
Katja
Gold
Posts: 14
Joined: 21 Nov 2011 11:29
Family Historian: None

Widowed

Post by Katja » 28 Nov 2011 20:21

Thank you also from me!
It works as I wished. I wasn't able to try it sooner, because my 5-months-old didn't give me much free time today [smile]

I really appreciate your help!

Locked