Page 1 of 1

Custom Source Template ? Branching ?

Posted: 25 Jul 2022 19:46
by BevSmallwood
I have a custom source template in RootsMagic for Swedish parish books. One source per book.

I might view a particular book on one of (at least) four websites or on microfilm via the Family History Library. In RootsMagic this is how it looks:

[ParishName] [Volume] [Period]<, [Page]><; [Repository]>;
<viewed on <i>Riksarkivet</i> ([URLRiksarkivet] : accessed [Date])>
<viewed on <i>ArkivDitigal</i> ([URLArkivDigital] : accessed [Date])>
<viewed on <i>MyHeritage</i> "Sweden Household Examination Books, 1880 - 1920" ([URLMyHeritage] : accessed [Date])>
<viewed on <i>Ancestry</i> "Sweden, Church Records, 1500-1941" ([URLAncestry] : accessed [Date])>
<microfilmed by the Genealogical Society of Utah< [FilmDate]>, microfilm [FilmNo])>
<<i>[SrcNotes]</i>>.

When citing the Swedish record book, I enter the date and whichever URL I enter controls the language of that part of the footnote. This way entails having a separate URL field for each website.

Does FH language have the ability to conditionally select which section to go with by matching a value? In other words, can I create a source with website, date, and url and have FH choose the correct output based on the value of the website?

Thank you
Bev

Re: Custom Source Template ? Branching ?

Posted: 25 Jul 2022 21:30
by tatewise
I'm not entirely sure but I think you want to have just one Footnote Format for the viewed on section.
i.e.
<viewed on <i>xxxxxxx</i>yyyyyyy yyyyy yyyy ({URL} : accessed {Date})>
where xxxxxxx and yyyyyyy yyyyy yyyy are conditional on the {URL} value.

That should be possible with the {=TextIf( ... )} function and the {URL} Data Ref %SOUR.~UL-URL%.
e.g.
{=TextIf( LeftText( %SOUR.~UL-URL%, 16 ) = 'https://abc.....', 'Riksarkivet' )}
{=TextIf( LeftText( %SOUR.~UL-URL%, 16 ) = 'https://xyz.....', 'ArkivDitigal' )}
{=TextIf( LeftText( %SOUR.~UL-URL%, 26 ) = 'https://www.myheritage.com', 'MyHeritage' )}
{=TextIf( LeftText( %SOUR.~UL-URL%, 26 ) = 'https://www.ancestry.co.uk', 'Ancestry' )}

Similarly, the yyyyyyy yyyyy yyyy text can be conditional on the URL.
{=TextIf( LeftText( %SOUR.~UL-URL%, 26 ) = 'https://www.myheritage.com', ' "Sweden Household Examination Books, 1880 - 1920"' )}
{=TextIf( LeftText( %SOUR.~UL-URL%, 26 ) = 'https://www.ancestry.co.uk', ' "Sweden, Church Records, 1500-1941"' )}

Re: Custom Source Template ? Branching ?

Posted: 25 Jul 2022 22:48
by BevSmallwood
That's really cool, but I have now idea how to implement it.

Where can I read up on this? The "Getting the Most out of Family Historian 5" glosses over sourcing and the help files have not been that helpful. This looks like query language. Can that be incorporated into the source template definition?

thank you
Bev

PS : I ultimately decided to remove the db names to standardize all four to the same entry using just
website (url : accessed date)

Re: Custom Source Template ? Branching ?

Posted: 26 Jul 2022 10:02
by tatewise
The "Getting the Most out of FH" manual won't help much because Source Templates are new in FH V7.
Anyway, that manual does not discuss advanced techniques such as those {=TextIf( ... )} functions.

Sorry, I assumed you had found Tools > Source Template Definitions... where templates can be edited.
You enter the script I suggested in the Footnote Format: box.
I presume that is where you edited the template to standardize the footnote, or did you do that in RM?

You asked whether the FH language has the ability to conditionally select sections, so yes it is similar to a query language.

Re: Custom Source Template ? Branching ?

Posted: 26 Jul 2022 17:19
by BevSmallwood
Yes - on a previous message chain we talked about Source Template Definitions. I've been building there, importing to project, tweeking then syncing back to the ?master collection?

I'll need to revisit your reply as I get more comfortable with FH.

my footnote now reads:
{ParishName} {Volume} {Period}, <{Page}>; {Repository}; <<i>{Website}</i> <({URL} : accessed {AccessDate})>>.

I don't see anything specific to this on the Source Template Definition Editor so I'm assuming I would enter:

{ParishName} {Volume} {Period}, <{Page}>; {Repository}; <<i>{Website}</i>

[query language adding a field should circumstances be met]

<({URL} : accessed {AccessDate})>>.

Re: Custom Source Template ? Branching ?

Posted: 26 Jul 2022 17:32
by tatewise
Yes, you are correct, although everything must be entered on one long single line, and in FH we talk about Expressions rather than query language.

There is advice in the FHUG KB on Understanding Expressions.
Source Template Definitions are not specifically mentioned but their Format definitions do support Expressions.

Your advanced Footnote Format would look like:
{ParishName} {Volume} {Period}, <{Page}>; {Repository}; <<i>{Website}</i> <({=TextIf( LeftText( %SOUR.~UL-URL%, 26 ) = 'https://www.myheritage.com', '"Sweden Household Examination Books, 1880 - 1920" ' )}{=TextIf( LeftText( %SOUR.~UL-URL%, 26 ) = 'https://www.ancestry.co.uk', '"Sweden, Church Records, 1500-1941" ' )}{URL} : accessed {AccessDate})>>.