* Source Templates, Style Codes and Record Title formats

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
shoshk
Famous
Posts: 242
Joined: 13 May 2015 16:28
Family Historian: V7
Location: Mitzpe Jericho, Israel

Source Templates, Style Codes and Record Title formats

Post by shoshk » 28 Jan 2021 08:17

It looks like Style Codes are not available in the Record Title format. Why?

My current titles include the person's name in the format SURNAME, Given. My husband wants to keep it that way but I don't see an easy way to do it with templated sources. I can program it, but would prefer not to.

Should I add it to the wish list?
Shosh Kalson

User avatar
Jane
Site Admin
Posts: 8440
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Re: Source Templates, Style Codes and Record Title formats

Post by Jane » 28 Jan 2021 10:10

The record title is not a Rich Text note field, it's a standard text field, which is populated by the template when the templated source is entered or changed, by default.

If you want to edit it manually untick the Auto Generated option next to the title field in the Citation Window.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

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

Re: Source Templates, Style Codes and Record Title formats

Post by tatewise » 28 Jan 2021 11:40

Sorry, but I don't understand the problem
The name format SURNAME, Given is nothing to do with Style Codes.

In the Source Templates I've looked at, that have a Name field, they simply repeat whatever is entered as the Name in the Title.

So if you enter the Name as SURNAME, Given then that is what you get in the Title.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
shoshk
Famous
Posts: 242
Joined: 13 May 2015 16:28
Family Historian: V7
Location: Mitzpe Jericho, Israel

Re: Source Templates, Style Codes and Record Title formats

Post by shoshk » 28 Jan 2021 12:12

I need 2 versions of the name. In addition to using SURNAME, Given in the title, I use Given Surname in the formatted footnote.

I guess I'll take care of this programmatically. It's not difficult because our sources are all created via plugin (currently being rewritten to take advantage of new features in FH7). I simply prefer to let FH do the heavy lifting whenever possible.
Shosh Kalson

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

Re: Source Templates, Style Codes and Record Title formats

Post by tatewise » 28 Jan 2021 12:45

OK, that is possible.
Enter the Name using the SURNAME, Given format and construct the Footnote Template to extract the two name parts, reverse them and adjust the SURNAME to Surname:

{=Section(%SOUR.~TX-NAME%,2,",")} extracts the 2nd Section of Given name(s) after the comma.

{=Text(LeftText(Section(%SOUR.~TX-NAME%,1,","),1).ToLower(MidText(Section(%SOUR.~TX-NAME%,1,","),2)))}
This extracts the 1st Section before comma, leaves left-hand character in capitals and makes the remainder lower case.
The Text concatenation is needed because otherwise a space gets inserted between the functions.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
shoshk
Famous
Posts: 242
Joined: 13 May 2015 16:28
Family Historian: V7
Location: Mitzpe Jericho, Israel

Re: Source Templates, Style Codes and Record Title formats

Post by shoshk » 28 Jan 2021 13:34

Pretty much (if not all) the fields in the source template are filled in automatically by the plugin.

One of the features of my plugin is that is copies (can copy) much of its data from the source (using copy and paste) from the webpage. Often, the name is in the format Given Surname.

I think I'll just add two fields to the source template for the uppercase version of the surname -- TX-SURNAME_1 and TX-SURNAME_2. It's trivial to add a few lines to the plugin to fill in these fields.

I was just hoping that this business could be handled by FH, but I understand why style codes don't apply in the title format
Shosh Kalson

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

Re: Source Templates, Style Codes and Record Title formats

Post by tatewise » 28 Jan 2021 14:35

I'm not sure why you keep mentioning Style Codes.
They have nothing to do with manipulating plain text and changing case.
The code I posted are NOT Style Codes, which are to do with bold, italics, underline, and suchlike.
However, I could not devise codes to convert Given Surname to SURNAME, Given so you will have to use two fields.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
shoshk
Famous
Posts: 242
Joined: 13 May 2015 16:28
Family Historian: V7
Location: Mitzpe Jericho, Israel

Re: Source Templates, Style Codes and Record Title formats

Post by shoshk » 28 Jan 2021 14:39

I know I can't use Style Codes in the Record format. I wish I could. That would allow me to format the surname as uppercase without writing more code.
Shosh Kalson

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

Re: Source Templates, Style Codes and Record Title formats

Post by tatewise » 28 Jan 2021 14:46

Shosh, I will say it once again and then shut up.
Style Codes DO NOT CHANGE CASE or SWAP WORDS they ONLY affect font style like bold, italic, underscore.

The codes I posted earlier would work in the Record Title Template just as well as in the Footnote Template.
They are ONLY manipulating plain text and not font styles.
They just convert from SURNAME, Given to Given Surname and no Style Codes are involved.

I simply can't work out the codes need to convert from Given Surname to SURNAME, Given because there is no convenient delimiter (,).

The code that converts to uppercase is {=ToUpper(...)} and that is a Function code not a Style Code.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
shoshk
Famous
Posts: 242
Joined: 13 May 2015 16:28
Family Historian: V7
Location: Mitzpe Jericho, Israel

Re: Source Templates, Style Codes and Record Title formats

Post by shoshk » 29 Jan 2021 05:42

As always, morning wake-up gave me a simple solution which is taken from the idea proposed by you.

I had not considered using FH functions within the title format.

I won't be adding (and maintaining an extra field). The following expression gives me exactly what I need:

Code: Select all

{=ToUpper(%SOUR.~NM-Name_Recorded_1:SURNAME%)}, {Name_Recorded_1:GIVEN}
Thank you for your persistence which clearly triggered the little guy in my brain who keeps pondering while I sleep. :)
Shosh Kalson

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

Re: Source Templates, Style Codes and Record Title formats

Post by tatewise » 29 Jan 2021 11:11

Yes, excellent. I had not realised you were using a Name (NM) meta-field rather than a Text (TX) meta-field.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

Post Reply