* Determining if a Fact has any Witnesses

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
macmcd
Silver
Posts: 8
Joined: 27 Mar 2023 14:08
Family Historian: V7

Determining if a Fact has any Witnesses

Post by macmcd » 31 Mar 2023 17:51

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.

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

Re: Determining if a Fact has any Witnesses

Post by tatewise » 31 Mar 2023 17:55

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.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
macmcd
Silver
Posts: 8
Joined: 27 Mar 2023 14:08
Family Historian: V7

Re: Determining if a Fact has any Witnesses

Post by macmcd » 01 Apr 2023 09:23

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.

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

Re: Determining if a Fact has any Witnesses

Post by tatewise » 01 Apr 2023 10:10

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.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
macmcd
Silver
Posts: 8
Joined: 27 Mar 2023 14:08
Family Historian: V7

Re: Determining if a Fact has any Witnesses

Post by macmcd » 01 Apr 2023 12:10

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?

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

Re: Determining if a Fact has any Witnesses

Post by tatewise » 01 Apr 2023 12:32

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.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
macmcd
Silver
Posts: 8
Joined: 27 Mar 2023 14:08
Family Historian: V7

Re: Determining if a Fact has any Witnesses

Post by macmcd » 01 Apr 2023 20:55

Thanks again Mike. That is a much simpler solution. Onto the next.

Post Reply