* Source Template Definition and Generic Type

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
Medows
Gold
Posts: 16
Joined: 16 May 2016 12:28
Family Historian: V7

Source Template Definition and Generic Type

Post by Medows » 29 Mar 2023 10:38

Environment: FH7.0.19, AS 7.7.2, Windows 11 22H2

Typically my namimg conventions follow the same format for media attachments, source titles and source citations and that is ffff, yyyy, ssss gggg
where ffff = fact type, yyyy = year, ssss = keyperson surname, gggg = keyperson given names
The only exception to this rule is 1939 Register.
I am trying to use the Census Returns via Ancestral Sources to achieve this same thing.
Examples...
Census, 1911, Medows Alan
Electoral Register, 1955, Medows Alan
1939 Register, Medows Alan

I can get this working in AS ok but whenever I put this into FH the output of the source citation for 1939Register is...
Census, 1939, Medows Alan

I do not want to create a new source template specifically for 1939 Register.

I noticed that AS writes the source type into the Generic Type in FH. So in AS the source Census has categories Census, Electoral and Register where Register refers to 1939 Register.

So I tried to amend the Census Returns template to pick up the Generic type field but I failed miserably. I looked at the FH help - https://www.family-historian.co.uk/help ... rmats.html but it is difficult to interpret and I have tried following ways to pick up the Generic Type or failing that my own added field of type...

These are examples that I have tried. I must be doing something wrong. I am new to this area but I thought I had understood the princples.

Attempt 1...
=ItemIf({=GetRecord():Type}="Register",1939 Register, {=GetRecord():Type}, {Year:YEAR}), {Head_of_Household:SURNAME} {Head_of_Household:GIVEN}

Attempt 2...
ItemIf(%SOUR._TYPE%="Register",1939 Register, %SOUR._TYPE%, {Year:YEAR}), {Head_of_Household:SURNAME} {Head_of_Household:GIVEN}


I hope I have explained this well enough. All help gratefully welcomed...

Kind Regards

Alan

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

Re: Source Template Definition and Generic Type

Post by tatewise » 29 Mar 2023 11:26

Hi Alan, Yes, the expression does get a bit complex so let's break it down.

You are trying to display text so you need the TextIf( ... ) function not ItemIf( ... ).
Also, it must be enclosed in { curly brackets } to distinguish it from plain text and needs a leading = sign.
i.e.
{=TextIf( ... )}

Your condition %SOUR._TYPE%="Register" and text parameter "1939 Register" are fine.
So a useful interim step would be to just enter that alternative text parameter as plain text such as:
{=TextIf( %SOUR._TYPE%="Register", "1939 Register", "Alternative" )} and see how that works.

Now the alternative text parameter needs to be one text string but the embedded comma implies two parameters.
So the three components need to be enclosed within a Text( ... ) function.
Also, you cannot use curly bracketed references like {Year:YEAR} within functions so the Metafield Shortcut data reference format must be used like %SOUR.~DT-YEAR:YEAR% or if the Year field only holds a year then %SOUR.~DT-YEAR% will be OK.
e.g.
Text( %SOUR._TYPE% . ", " . %SOUR.~DT-YEAR:YEAR% ) or Text( %SOUR._TYPE% . ", " . %SOUR.~DT-YEAR% )

Thus the final expression is:
{=TextIf( %SOUR._TYPE%="Register", "1939 Register", Text( %SOUR._TYPE% . ", " . %SOUR.~DT-YEAR% ) )}
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
Medows
Gold
Posts: 16
Joined: 16 May 2016 12:28
Family Historian: V7

Re: Source Template Definition and Generic Type

Post by Medows » 29 Mar 2023 16:01

Mike,
That was great and works perfectly. :D. Really appreciate your help.

I did a number of tests with Census and 1939 Register. This was my final string...
{=TextIf( %SOUR._TYPE%="Register", "1939 Register", Text( %SOUR._TYPE% . ", " . %SOUR.~DT-YEAR% ) )}, {Head_of_Household:SURNAME} {Head_of_Household:GIVEN}.

BTW. Does your wife cook as well as you do with FH functionality? Some of the recipes look good as well.

Post Reply