I have created a Memorial attribute, and am trying to write a sentence to cover all eventualities. I am using the fields as follows:
Place - location of cemetery etc (eg Anytown)
Value - name or description of memorial (eg Smith family memorial)
The following sentence works reasonably well:
{individual} is named on a memorial <({value})> {place}
but I am struggling to write a sentence that could work without resorting to putting the Value in brackets.
What I would like to see is:
Place only: He is named on a memorial in Anytown.
Place and Value: He is named on the Smith family memorial in Anytown.
Value only: He is named on the Smith family memorial.
(I'm hoping that the Value only definition would also work with websites, eg "He is named on the Roll of Honour website.")
In other words, if the Value exists, I'd like the variable part of the sentence to be "He is named on the" and if it doesn't exist, I'd like it to be "He is named on a memorial".
I've found a few references in the Knowledge Base to limitations on the use of Value, but this is all a bit beyond me. Is what I am looking for actually doable, and if so, can anyone help, please?
Thanks,
Arthur
* Fact sentence where Value may or may not exist
- tatewise
- Megastar
- Posts: 27082
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Fact sentence where Value may or may not exist
Yes, you cannot achieve that with the Template Codes alone and need to use functions.
In this case the =CombineText(...) function is best, because it combines different text with a variable depending on whether it has a value or not. See the Help on Functions for details.
e.g.
{individual} is named on{=CombineText(" the ",%FACT%,""," a memorial")} {place}
The way it works is if the %FACT% has a value then it is combined with " the " and "" otherwise " a memorial" is displayed. In this example %FACT% is synonymous with {value} but Template Codes such as {value} are not currently allowed within Functions. I have a Wish List request to allow them and make such functions more flexible.
That template works with all four eventualities of no value, or value supplied, combined with no Place, or Place supplied.
In this case the =CombineText(...) function is best, because it combines different text with a variable depending on whether it has a value or not. See the Help on Functions for details.
e.g.
{individual} is named on{=CombineText(" the ",%FACT%,""," a memorial")} {place}
The way it works is if the %FACT% has a value then it is combined with " the " and "" otherwise " a memorial" is displayed. In this example %FACT% is synonymous with {value} but Template Codes such as {value} are not currently allowed within Functions. I have a Wish List request to allow them and make such functions more flexible.
That template works with all four eventualities of no value, or value supplied, combined with no Place, or Place supplied.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Fact sentence where Value may or may not exist
Thank you very much, Mike. It would have taken me hours to get there by myself - it's quite some way beyond my current expertise.