Page 1 of 1

Last Married Name

Posted: 19 Mar 2022 18:06
by Gary Carson
Am trying to create a last married name for females only in a Result Set column in various queries.

=TextIf((%INDI.SEX%=Female)(Exists(%INDI.FAMS[last]>HUSB>%),%INDI.FAMS[last]>HUSB>NAME:SURNAME%,%INDI.NAME:SURNAME%)

The above expression is not valid. How do I correct. I want result for only females exclusive of males.

Re: Last Married Name

Posted: 19 Mar 2022 19:28
by tatewise
You need to turn the condition parameter into a valid boolean expression:

=TextIf( IsTrue( ( %INDI.SEX% = "Female" ) and Exists( %INDI.FAMS[last]>HUSB>% ) ), %INDI.FAMS[last]>HUSB>NAME:SURNAME% ,%INDI.NAME:SURNAME% )

Re: Last Married Name

Posted: 19 Mar 2022 19:45
by Gary Carson
When I insert expression you corrected for me, males are also listed with surname.

Re: Last Married Name

Posted: 19 Mar 2022 21:05
by tatewise
Yes, well that is what the expression does.
If the person is female and has a husband, it shows the last husband's surname, otherwise (for males and unmaried women) it shows the person's surname.
You need nested TextIf if you want to exclude males altogether.

Re: Last Married Name

Posted: 20 Mar 2022 00:34
by Gary Carson
I am having trouble to nest expression to achieve desired result. Help/hint please.

Re: Last Married Name

Posted: 20 Mar 2022 10:48
by tatewise
The nesting approach needs to replace %INDI.NAME:SURNAME% with a TextIf(...) function such as:
TextIf( %INDI.SEX% = "Female", %INDI.NAME:SURNAME%, "" )

Tip: Ensure the ( parentheses ) are correctly nested by counting them in pairs.

However, in this case, there is another solution using the =Sex(...) and =CombineText(...) functions:
=Sex( %INDI%, "", CombineText( "", %INDI.FAMS[last]>HUSB>NAME:SURNAME%, "", %INDI.NAME:SURNAME% ), "")
i.e.
=Sex( %INDI%, <male name blank>, <female name expression>, <unknown sex blank> )

<female name expression> = CombineText( "", %INDI.FAMS[last]>HUSB>NAME:SURNAME%, "", %INDI.NAME:SURNAME% )
i.e.
CombineText( <blank prefix>, <last husband surname>, <blank suffix>, <maiden name when no husband> )

Re: Last Married Name

Posted: 20 Mar 2022 15:50
by Gary Carson
Great help. Thanks