* Multiple functions in expression
- Hanning
- Diamond
- Posts: 84
- Joined: 29 Jul 2015 06:29
- Family Historian: V7
- Location: Pirongia, New Zealand
- Contact:
Multiple functions in expression
Can anyone see why this expression won't return the following?
=CombineText(TextIf(Exists(%INDI.BIRT.DATE%),%INDI.BIRT.DATE:YEAR%,%INDI.BAPM.DATE:YEAR%),TextIf(Exists(%INDI.DEAT.DATE%),CombineText("-",%INDI.DEAT.DATE:YEAR%,%INDI.BURI.DATE:YEAR%,),),,)
Give birth year if present otherwise baptism year, then if death date present put a -, & death year, or if not present then burial year.
I did have it working with the - in the centre, but tried to refine it to remove the - when there were no dates and now of course have got myself into a pickle!
=CombineText(TextIf(Exists(%INDI.BIRT.DATE%),%INDI.BIRT.DATE:YEAR%,%INDI.BAPM.DATE:YEAR%),TextIf(Exists(%INDI.DEAT.DATE%),CombineText("-",%INDI.DEAT.DATE:YEAR%,%INDI.BURI.DATE:YEAR%,),),,)
Give birth year if present otherwise baptism year, then if death date present put a -, & death year, or if not present then burial year.
I did have it working with the - in the centre, but tried to refine it to remove the - when there were no dates and now of course have got myself into a pickle!
Marlene
Researching Snell and Harris in Devon, Rooks in Cambridgeshire, Barton & Parker in Kent, Harley in Fife
Researching Snell and Harris in Devon, Rooks in Cambridgeshire, Barton & Parker in Kent, Harley in Fife
- Hanning
- Diamond
- Posts: 84
- Joined: 29 Jul 2015 06:29
- Family Historian: V7
- Location: Pirongia, New Zealand
- Contact:
Re: Multiple functions in expression
Cancel!! I worked it out...
=CombineText(TextIf(Exists(%INDI.BIRT.DATE%),%INDI.BIRT.DATE:YEAR%,%INDI.BAPM.DATE:YEAR%),TextIf(Exists(%INDI.DEAT.DATE%),CombineText(" -",%INDI.DEAT.DATE:YEAR%),CombineText("-",%INDI.BURI.DATE:YEAR%)),,)
See attached screenshot for the result.
=CombineText(TextIf(Exists(%INDI.BIRT.DATE%),%INDI.BIRT.DATE:YEAR%,%INDI.BAPM.DATE:YEAR%),TextIf(Exists(%INDI.DEAT.DATE%),CombineText(" -",%INDI.DEAT.DATE:YEAR%),CombineText("-",%INDI.BURI.DATE:YEAR%)),,)
See attached screenshot for the result.
- Attachments
-
- Diagram - dates.png (17.09 KiB) Viewed 582 times
Marlene
Researching Snell and Harris in Devon, Rooks in Cambridgeshire, Barton & Parker in Kent, Harley in Fife
Researching Snell and Harris in Devon, Rooks in Cambridgeshire, Barton & Parker in Kent, Harley in Fife
- Hanning
- Diamond
- Posts: 84
- Joined: 29 Jul 2015 06:29
- Family Historian: V7
- Location: Pirongia, New Zealand
- Contact:
Re: Multiple functions in expression
Well, partially worked it out but it is not returning birth or baptism information if there is no death information....
Marlene
Researching Snell and Harris in Devon, Rooks in Cambridgeshire, Barton & Parker in Kent, Harley in Fife
Researching Snell and Harris in Devon, Rooks in Cambridgeshire, Barton & Parker in Kent, Harley in Fife
- tatewise
- Megastar
- Posts: 27083
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Multiple functions in expression
Why not use the =LifeDates(...) or =LifeDates2(...) function that do exactly what you want?
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
- Hanning
- Diamond
- Posts: 84
- Joined: 29 Jul 2015 06:29
- Family Historian: V7
- Location: Pirongia, New Zealand
- Contact:
Re: Multiple functions in expression
Thanks tatewise, but I really am trying just to get the years with a hyphen between without any words at all. I am getting bap., bur. etc when I use Lifedates or Lifedate2.
Marlene
Researching Snell and Harris in Devon, Rooks in Cambridgeshire, Barton & Parker in Kent, Harley in Fife
Researching Snell and Harris in Devon, Rooks in Cambridgeshire, Barton & Parker in Kent, Harley in Fife
- tatewise
- Megastar
- Posts: 27083
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Multiple functions in expression
Ok, I've investigated this overnight and come up with three potential solutions.
In each case, I've assumed you don't want a hyphen (-) on its own when there are no years at all, but that can be easily changed.
1) Use =CombineText_AB(...) function with your expressions.
This new function in FH V7 will cope with either or both years being present. See the Help for details.
=CombineText_AB( TextIf(Exists(%INDI.BIRT.DATE%),%INDI.BIRT.DATE:YEAR%,%INDI.BAPM.DATE:YEAR%), TextIf(Exists(%INDI.DEAT.DATE%),%INDI.DEAT.DATE:YEAR%,%INDI.BURI.DATE:YEAR%), "2|#A-|#A-#B|-#B|" )
One snag is that does not cope with Christening Dates or Cremation Dates.
So it would need more TextIf(...) conditions to include them.
2) Use =CombineText_AB(...) function with EstimatedBirth/Death Date(...) functions.
This uses the estimation functions to include all years based on Birth, Baptism, Christening, Death, Cremation & Burial.
=CombineText_AB( Year(EstimatedBirthDate(,MID,0)), Year(EstimatedDeathDate(,MID,0)), "2|#A-|#A-#B|-#B|" )
A snag is that it may include years estimated by inspecting very close relatives or Tools > Preferences > Estimates.
3) Extract the years from =LifeDates(...) function.
The LifeDates(...) function provides the years you want but adds other characters that this expression removes.
It is complicated by some Life Date having hyphen separators and some having comma separators.
=CombineText( Text(RightText(Section(Section(LifeDates(),1,"-"),1,"?"),4)."-"), RightText(Section(Section(LifeDates(),2,"-"),1,"?"),4), , CombineText(Text(RightText(Section(Section(LifeDates(),1,","),1,"?"),4)."-"), RightText(Section(Section(LifeDates(),2,","),1,"?"),4) ) )
This makes use of the new FH V7 Section(...) function to split text on separators such as "-", "," and "?" as explained...
The two CombineText(...) functions cope with Life Dates with "-" separators and others with "," separators.
e.g.
Section(LifeDates(),1,"-") returns 1st section of "-" separated dates, i.e. Birth year.
Section(LifeDates(),2,",") returns 2nd section of "," separated dates, i.e. Cremation or Burial year.
Section(Section(LifeDates(),2,"-"),1,"?") removes the trailing "?" from inexact years.
Then RightText(...,4) extracts the 4 year digits.
It is feasible to replace LifeDates() with LifeDates(,EXT) or LifeDates2() or LifeDates2(,EXT).
If any of the above options are not clear then please ask.
In each case, I've assumed you don't want a hyphen (-) on its own when there are no years at all, but that can be easily changed.
1) Use =CombineText_AB(...) function with your expressions.
This new function in FH V7 will cope with either or both years being present. See the Help for details.
=CombineText_AB( TextIf(Exists(%INDI.BIRT.DATE%),%INDI.BIRT.DATE:YEAR%,%INDI.BAPM.DATE:YEAR%), TextIf(Exists(%INDI.DEAT.DATE%),%INDI.DEAT.DATE:YEAR%,%INDI.BURI.DATE:YEAR%), "2|#A-|#A-#B|-#B|" )
One snag is that does not cope with Christening Dates or Cremation Dates.
So it would need more TextIf(...) conditions to include them.
2) Use =CombineText_AB(...) function with EstimatedBirth/Death Date(...) functions.
This uses the estimation functions to include all years based on Birth, Baptism, Christening, Death, Cremation & Burial.
=CombineText_AB( Year(EstimatedBirthDate(,MID,0)), Year(EstimatedDeathDate(,MID,0)), "2|#A-|#A-#B|-#B|" )
A snag is that it may include years estimated by inspecting very close relatives or Tools > Preferences > Estimates.
3) Extract the years from =LifeDates(...) function.
The LifeDates(...) function provides the years you want but adds other characters that this expression removes.
It is complicated by some Life Date having hyphen separators and some having comma separators.
=CombineText( Text(RightText(Section(Section(LifeDates(),1,"-"),1,"?"),4)."-"), RightText(Section(Section(LifeDates(),2,"-"),1,"?"),4), , CombineText(Text(RightText(Section(Section(LifeDates(),1,","),1,"?"),4)."-"), RightText(Section(Section(LifeDates(),2,","),1,"?"),4) ) )
This makes use of the new FH V7 Section(...) function to split text on separators such as "-", "," and "?" as explained...
The two CombineText(...) functions cope with Life Dates with "-" separators and others with "," separators.
e.g.
Section(LifeDates(),1,"-") returns 1st section of "-" separated dates, i.e. Birth year.
Section(LifeDates(),2,",") returns 2nd section of "," separated dates, i.e. Cremation or Burial year.
Section(Section(LifeDates(),2,"-"),1,"?") removes the trailing "?" from inexact years.
Then RightText(...,4) extracts the 4 year digits.
It is feasible to replace LifeDates() with LifeDates(,EXT) or LifeDates2() or LifeDates2(,EXT).
If any of the above options are not clear then please ask.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
- Hanning
- Diamond
- Posts: 84
- Joined: 29 Jul 2015 06:29
- Family Historian: V7
- Location: Pirongia, New Zealand
- Contact:
Re: Multiple functions in expression
Hi Mike
Thanks so much for spending time on it - I will try them all to see which I like best. The overall purpose is to give a very economical diagram that can be arranged to fit one one or two pages, with the addition perhaps of some colour coding to aid interpretation. I hope other users might find it useful as well.
Thank you again
Marlene
Thanks so much for spending time on it - I will try them all to see which I like best. The overall purpose is to give a very economical diagram that can be arranged to fit one one or two pages, with the addition perhaps of some colour coding to aid interpretation. I hope other users might find it useful as well.
Thank you again
Marlene
Marlene
Researching Snell and Harris in Devon, Rooks in Cambridgeshire, Barton & Parker in Kent, Harley in Fife
Researching Snell and Harris in Devon, Rooks in Cambridgeshire, Barton & Parker in Kent, Harley in Fife