* Using Function YEAR with Source Templates
Using Function YEAR with Source Templates
I have a source template definition which has a date field and I want to use the year of the date field to populate the Footnote and Record Title formats..
My goal is to call the footnote, for example, "PR Burial, 1876, Ide William". The year appears in a death date in this source template.
I checked the FH7 User Manual and implied that I could set up a line like this but it is not displaying any field at all...
{=LeftText(["{author}"],3)} If used in a context in which {author} is a valid field code, this function will return the leftmost 3 letters of the author's name.
So I set up my line like this...
Burial, {=Year(["{Date_of_burial}"])}, {surname} {given_name}
Date of burial --> {Date_of_burial} --> Date
Has anybody got any ideas please?
Alan
My goal is to call the footnote, for example, "PR Burial, 1876, Ide William". The year appears in a death date in this source template.
I checked the FH7 User Manual and implied that I could set up a line like this but it is not displaying any field at all...
{=LeftText(["{author}"],3)} If used in a context in which {author} is a valid field code, this function will return the leftmost 3 letters of the author's name.
So I set up my line like this...
Burial, {=Year(["{Date_of_burial}"])}, {surname} {given_name}
Date of burial --> {Date_of_burial} --> Date
Has anybody got any ideas please?
Alan
-
Peter Collier
- Famous
- Posts: 191
- Joined: 04 Nov 2015 17:32
- Family Historian: V7
- Location: Worcestershire, UK
Re: Using Function YEAR with Source Templates
I use the following for the title in a source record for electoral roll entries:
Record Title Format: {Date:YEAR} electoral roll - {LGA}, {Ward}
Where Date is a defined date field and LGA and Ward are defined text fields in my source template.
Record Title Format: {Date:YEAR} electoral roll - {LGA}, {Ward}
Where Date is a defined date field and LGA and Ward are defined text fields in my source template.
Peter Collier
Collier, Savory, Buckerfield, Edmonds, Low, Dungey, Lester, Chambers, Walshe, Moylan, Bradley, Connors, Udale, Wilson, Benfield, Downey
Collier, Savory, Buckerfield, Edmonds, Low, Dungey, Lester, Chambers, Walshe, Moylan, Bradley, Connors, Udale, Wilson, Benfield, Downey
-
Peter Collier
- Famous
- Posts: 191
- Joined: 04 Nov 2015 17:32
- Family Historian: V7
- Location: Worcestershire, UK
Re: Using Function YEAR with Source Templates
Also, if you want to save the effort of having separate fields for surname and given names, you can just define a single name field and use "REVERSE" to have the surname first when you need that. for example, {Name} would output William Idle and {Name:REVERSE} would output Idle, William.
Peter Collier
Collier, Savory, Buckerfield, Edmonds, Low, Dungey, Lester, Chambers, Walshe, Moylan, Bradley, Connors, Udale, Wilson, Benfield, Downey
Collier, Savory, Buckerfield, Edmonds, Low, Dungey, Lester, Chambers, Walshe, Moylan, Bradley, Connors, Udale, Wilson, Benfield, Downey
Re: Using Function YEAR with Source Templates
Alan
- tatewise
- Megastar
- Posts: 27074
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Using Function YEAR with Source Templates
Yes, see the FHUG Knowledge Base articles listed below and their links to FH Help documentation.
Understanding Expressions
Understanding Data References where the :YEAR qualifier is mentioned.
Understanding Functions where the =Year(...) function is mentioned.
BTW: Theoretically, the {=Year(["{Date_of_burial}"])} function should work in Source Template Definitions but I also could not get it to display anything. Maybe it is a bug that should be reported to CP via http://www.calico-pie.com/osticket/open.php.
The other functions such as =Month(...) and =Day(...) also do not work and the qualifiers such as :DAY and :MONTH_NUMBER are also not allowed in Source Template Definitions.
However, the alternative form using Data Ref such as {=Day(%SOUR.~DT-DATE%)} {%SOUR.~DT-DATE:DAY%} work fine.
Understanding Expressions
Understanding Data References where the :YEAR qualifier is mentioned.
Understanding Functions where the =Year(...) function is mentioned.
BTW: Theoretically, the {=Year(["{Date_of_burial}"])} function should work in Source Template Definitions but I also could not get it to display anything. Maybe it is a bug that should be reported to CP via http://www.calico-pie.com/osticket/open.php.
The other functions such as =Month(...) and =Day(...) also do not work and the qualifiers such as :DAY and :MONTH_NUMBER are also not allowed in Source Template Definitions.
However, the alternative form using Data Ref such as {=Day(%SOUR.~DT-DATE%)} {%SOUR.~DT-DATE:DAY%} work fine.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
- Mark1834
- Megastar
- Posts: 2145
- Joined: 27 Oct 2017 19:33
- Family Historian: V7
- Location: South Cheshire, UK
Re: Using Function YEAR with Source Templates
I think it is a general issue with using field codes in functions. I use the TextPart() function in my templates to remove unnecessary elements from {Location} fields, but I could only get it to work using the long form %SOUR.~PL-LOCATION%.
I suspect FH is working as designed, but the help should say that field codes cannot be used as function arguments (if indeed that is the case).
I suspect FH is working as designed, but the help should say that field codes cannot be used as function arguments (if indeed that is the case).
Mark Draper
- tatewise
- Megastar
- Posts: 27074
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Using Function YEAR with Source Templates
But as Alan says, the Help gives the example of {=LeftText(["{author}"],3)} which works!
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry