* Creating a concatenated field in SOURCES in Records Window

Questions about Generic and Templated Sources within FH and their associated Citations and Repositories
Post Reply
avatar
Medows
Platinum
Posts: 36
Joined: 16 May 2016 12:28
Family Historian: V7

Creating a concatenated field in SOURCES in Records Window

Post by Medows »

I am a source template user and my source records can appear like this...
Birth Certificate, 1855, Bayley William Andrew

I want to create a separate field which in essence gives me an alternative sort sequence. This follow a stndard of generic sources supplied to me. My preferred option for the new field would be...
Bayley, William Andrew: Birth 1855

Is it possible to break up my Source Record Title or is it possible to create the concatenation from the source citation fields below...
%SOUR.~NM-Principal[1]% --> get surname
","
%SOUR.~NM-Principal[1]% --> get given names
":"
%SOUR._SRCT>% --> first word of source template name - Birth Certificate
" "
%SOUR.~DT-Date[1]% --> pick the year

Thanks in advance, Alan
User avatar
tatewise
Megastar
Posts: 28488
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Creating a concatenated field in SOURCES in Records Window

Post by tatewise »

Please confirm whether you would be happy to simply reformat the Source Record Title or not.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
Medows
Platinum
Posts: 36
Joined: 16 May 2016 12:28
Family Historian: V7

Re: Creating a concatenated field in SOURCES in Records Window

Post by Medows »

Hi Mike,
I am con=mfortable about reformatting templated sources and I do not want to reformat my record title. I did think it would be possibe to create a concatenated field but I am having problems.

OK Almost worked out.

=Text(%SOUR.~NM-Principal:SURNAME% . ", " . %SOUR.~NM-Principal:GIVEN% . ": " . LeftText(%SOUR%,5,"") . " " . %SOUR.~DT-Date:YEAR%)

I am struggling to find stuff in the help sections. So I still need to pick up all GIVEN names and not just the first one and the second part is getting the variable length of the event type when using LeftText. I have hardcoded 5 for birth but I really want to find the position of the first comma and I dont know if there is a find/search character function.

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

Re: Creating a concatenated field in SOURCES in Records Window

Post by tatewise »

Ok, you are very close. I think the following may be what you want but there are some caveats.

=Text( %SOUR.~NM-Principal:SURNAME_FIRST% . ": " . Section( %SOUR%, 1, "," ) . " " . %SOUR.~DT-Date:YEAR% )

%SOUR.~NM-Principal:SURNAME_FIRST% will display the Surname, a comma, and then the given names.
The Surname will be in uppercase if Tools > Preferences > General tab ticks Display surnames in upper case.
However, your %SOUR.~NM-Principal:SURNAME% suffers the same capitalisation effect.

Section( %SOUR%, 1, "," ) will display the section of the Title up to the 1st comma, e.g. Birth Certificate.
I'm not sure that is what you want because you also mention wanting the first word.

Section( %SOUR%, 1, " " ) will display the section of the Title up to the 1st space, e.g. Birth.
However, if there is only one word followed by a comma then that will not work.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
Medows
Platinum
Posts: 36
Joined: 16 May 2016 12:28
Family Historian: V7

Re: Creating a concatenated field in SOURCES in Records Window

Post by Medows »

Thanks Mike.
I found and used TEXTPART. Does that work the same way as SECTION?
Otherwise its looking good.
Thank you, Alan
User avatar
tatewise
Megastar
Posts: 28488
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Creating a concatenated field in SOURCES in Records Window

Post by tatewise »

Yes, if the separator is a comma, then the TextPart(...) function works similarly to the Section(...) function.

TextPart(...) also has extra features for tidying and arranging the comma-separated parts.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
Medows
Platinum
Posts: 36
Joined: 16 May 2016 12:28
Family Historian: V7

Re: Creating a concatenated field in SOURCES in Records Window

Post by Medows »

Thanks Mike. Much appreciated.

Alan
Post Reply