* Determining if a Fact has any Witnesses
Determining if a Fact has any Witnesses
Hello all,
I'm trying to write a sentence template using TextIf to output text depending if a fact has anyone assigned to a witness role. As I'm relatively new to this, I'm struggling to find the correct data expression to determine if a fact has any witnesses so any help would be appreciated.
Regards,
Mac.
I'm trying to write a sentence template using TextIf to output text depending if a fact has anyone assigned to a witness role. As I'm relatively new to this, I'm struggling to find the correct data expression to determine if a fact has any witnesses so any help would be appreciated.
Regards,
Mac.
- tatewise
- Megastar
- Posts: 27078
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Determining if a Fact has any Witnesses
Mac, have you looked at the standard facts to see how they conditionally output Fact Witness related text?
If that does not work for you then please explain in more detail what sentence structure you want to achieve.
However, in general, it is not possible to use TextIf(...) to determine if a Witness Role is in use.
If that does not work for you then please explain in more detail what sentence structure you want to achieve.
However, in general, it is not possible to use TextIf(...) to determine if a Witness Role is in use.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Determining if a Fact has any Witnesses
Thanks for the reply, Mike. Yes, I did look at some of the other facts sentences and they tend to use angled brackets to leave out unused roles. I am trying to list all the roles associated with a fact along these lines:
Present at the wedding were <{role=Witness} (witness);> <{role=mother of bride} (mother of the bride);> <{role=father of bride} (father of the bride);> etc.
Obviously, if there were no witness roles then I would be left with:
Present at the wedding were.
So I thought that I could use the TextIf expression to output the sentence if there are witnesses associated with a fact. I am unsure how to write a data expression that returns a true value if the fact has witnesses. Looking at www.gedsite.com there is an expression that does what I want:
[W:+] is true only if there is at least one witness
However, I am unsure how to write this in FH.
Present at the wedding were <{role=Witness} (witness);> <{role=mother of bride} (mother of the bride);> <{role=father of bride} (father of the bride);> etc.
Obviously, if there were no witness roles then I would be left with:
Present at the wedding were.
So I thought that I could use the TextIf expression to output the sentence if there are witnesses associated with a fact. I am unsure how to write a data expression that returns a true value if the fact has witnesses. Looking at www.gedsite.com there is an expression that does what I want:
[W:+] is true only if there is at least one witness
However, I am unsure how to write this in FH.
- tatewise
- Megastar
- Posts: 27078
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Determining if a Fact has any Witnesses
OK, so you only need to test for the existence of the 1st Fact Witness because you don't care how many or what Roles are involved but simply that one or more exist.
{=TextIf( Exists(%FACT._SHAR%), " Present at the wedding were ", )} should do it.
{=TextIf( Exists(%FACT._SHAR%), " Present at the wedding were ", )} should do it.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Determining if a Fact has any Witnesses
Thanks Mike. That will determine if there is a witness and thus output the sentence however I run into the angle brackets problem again. Thus the sentence:
{=TextIf( Exists(%FACT._SHAR%), " Present at the wedding were <{role=Witness} (witness);> <{role=mother of bride} (mother of the bride);> <{role=father of bride} (father of the bride);>", )}
outputs as:
Present at the wedding were <{role=Witness} (witness);> <{role=mother of bride} (mother of the bride);> <{role=father of bride} (father of the bride);>
Therefore, I guess I would need to use TextIf(a role has a witness) for each role and CombineText to build the sentence. Is there an iterative way of doing this?
{=TextIf( Exists(%FACT._SHAR%), " Present at the wedding were <{role=Witness} (witness);> <{role=mother of bride} (mother of the bride);> <{role=father of bride} (father of the bride);>", )}
outputs as:
Present at the wedding were <{role=Witness} (witness);> <{role=mother of bride} (mother of the bride);> <{role=father of bride} (father of the bride);>
Therefore, I guess I would need to use TextIf(a role has a witness) for each role and CombineText to build the sentence. Is there an iterative way of doing this?
- tatewise
- Megastar
- Posts: 27078
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Determining if a Fact has any Witnesses
No Mac, just use the expression exactly as I provided before any < angle brackets >
i.e.
{=TextIf( Exists(%FACT._SHAR%), " Present at the wedding were ", )}<{role=Witness} (witness);> <{role=mother of bride} (mother of the bride);> etc...
The TextIf(...) looks after the text phrase and each set of < angle brackets > looks after each witness Role.
i.e.
{=TextIf( Exists(%FACT._SHAR%), " Present at the wedding were ", )}<{role=Witness} (witness);> <{role=mother of bride} (mother of the bride);> etc...
The TextIf(...) looks after the text phrase and each set of < angle brackets > looks after each witness Role.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Determining if a Fact has any Witnesses
Thanks again Mike. That is a much simpler solution. Onto the next.