Page 1 of 1

conditional sentences using witness roles?

Posted: 03 Apr 2021 18:01
by DJY
I'm stuck and could use some help, please!

I'm trying to write a sentence for a sale so that I get one sentence if I have a witness role of "seller", a different sentence if I have a witness role of "buyer" and yet a third sentence if I don't have either of those roles. I tried nested conditionals but I couldn't get that to work here. (I think these brackets < > can have only one set of {curly brackets} inside them??)

I'm almost there with this simple sentence template: {individual}< sold to {role=buyer}>< bought from {role=seller}>< {value}>< {date}>< {_place}>. The problem with it is that I missing a verb when I have neither witness role in use. Sometimes I want the sentence to just say "He sold this thing" without having to know who bought it. (I don't care about the flip version of "He bought this thing" so I don't need the complexity of a 4th sentence.)

I tried playing with TextIf but that didn't work. I think the problem is I was searching for a role like {role=buyer} instead of just a text string somewhere. Is there a way to rewrite my sentence template to give the third sentence if neither role exists? (Or another way entirely to structure the sentence to do what I want?)

Re: conditional sentences using witness roles?

Posted: 03 Apr 2021 18:37
by Robert Jacobs
How about something like this (schematically — I haven't thought out the spacing , value, date, etc)

{place} was sold {date}; <{role=seller} was the seller><; {role=buyer} was the buyer>

Re: conditional sentences using witness roles?

Posted: 03 Apr 2021 18:58
by tatewise
It will work with =TextIf(...) by testing the existence of a shared Fact Witness tag _SHAR.
e.g.
{=TextIf( Exists(%FACT._SHAR%), "", "sold" )}

Re: conditional sentences using witness roles?

Posted: 03 Apr 2021 19:27
by DJY
Thank you, Robert. I appreciate the suggestion and was going to use that if I couldn't figure out the original structure. I'm using this one fact to help me figure out how these sentence structures work. I have bits and pieces of knowledge but I'm having a hard time seeing the overall framework among all the myriad examples.

Mike, the conditional textif works great! It looks like it only works if there are zero witnesses sharing the fact and doesn't take into account the type of role. If I have someone who is shared as another type of role (e.g., a plain old role of "witness" for someone who is the legal witness) and not a seller or a buyer, it will skip the conditional text and leave me with the original problem. Is there a way to make it look at a specific type of witness role? I think the instances where I have a legal witness but don't enter the name of the other party (seller or buyer) are pretty rare, so it's not critical for this particular sentence. I'm just trying to understand the options for sentence syntax for use in the future.

(I'm also trying to figure out why {Individual's} works but the parallel structure of {Principal's} doesn't work for a witness sentence! I tried using %CUR_PRIN% but can't figure out how to make it possessive. Any insight on the logic and how to do a possessive reference to the individual in a witness sentence would also be appreciated! )

Re: conditional sentences using witness roles?

Posted: 03 Apr 2021 19:52
by tatewise
Yes, the =TextIf(...) can test the Role of the shared Fact Witness.
e.g.
{=TextIf( %FACT._SHAR.ROLE% = "seller" or %FACT._SHAR.ROLE% = "buyer", "", "sold" )}

Note that this is testing only the 1st Fact Witness, i.e. effectively %FACT._SHAR[1].ROLE%
So if there is a seller or a buyer they must be the 1st Fact Witness with any witness as the 2nd Fact Witness

The key to knowing that %FACT._SHAR.ROLE% is what you need to test depends on become familiar with data references.

{principal's} is not listed in the Help as a valid code so cannot work.
If you want the possessive of His or Her or Their then use the =Sex(...) function.
e.g.
{=Sex( %CUR_PRIN%, "His", "Her", "Their" )}

Re: conditional sentences using witness roles?

Posted: 03 Apr 2021 21:18
by DJY
Thanks, Mike! You're once again a lifesaver! It may not look like it, but I swear I'm reading the help menu. :) It's just very overwhelming and full of specific examples pulled from many different help menu topics. When I don't find what I'm looking for, I'm never quite sure if I just haven't found it yet, or if it's impossible.