=TextIf function not working properly?


Graham Conner
 

Hi,

I have been using Family Historian for some time and been using my own Sentence Templates without problems. As I use both Place and Address data with the administrative location in the Place and postal address in the Address field, I wanted to be able to display or print out the address if it has been entered and if not display or print the place.  This is what I am trying to use in the Sentence Template for the Birth as an example.

 

<para>{%CUR_PRIN.NAME[1]:FULL%} was born {date} <at {=TextIf(Exists(%FACT.ADDR%),TextPart(%FACT.ADDR%,1,5,Tidy),TextPart(%FACT.PLAC%,1,5, Tidy))} > <({age})>

 

The TextIf seems to be broken, or I am not using it correctly and I am not sure which.  The above results in the Address being displayed if it has been entered, which is correct,  but if there is no Address, then it does not print out the Place. I end up with just the Name and Date of Birth and then nothing else.

 

I have tried cut and pasting examples from the Help screens to see if something simple would work, but these do not work either.

 

I have Family Historian 6.2.7 installed on a PC running Windows 10 and all the latest updates. I have tried reinstalling FH, and tested it on another PC. I get the same results.

 

Best Regards,

Graham

 


Mike Tate
 

Hi Graham,

Your Sentence Template expression is working perfectly for me.

I suspect to test it you are deleting the contents of the Address box.

But that does not delete the Address field and just leaves it blank until you close & open FH.

So that blank Address is what is being shown in the Sentence.

To completely delete the Address use the All tab and delete the Address field name on the left.

 

Why are you using {%CUR_PRIN.NAME[1]:FULL%} when using {individual} usually works just as well?

 

One minor problem is that the prefix ‘at’ does not usually read well with a Place name that reads better with ‘in’.

 

In this case the following works better that using <at {=TextIf(…)} >

{=CombineText("at ",TextPart(%FACT.ADDR%,1,5,Tidy),,Text("in " .TextPart(%FACT.PLAC%,1,5, Tidy)))}

 

Regards, Mike Tate

 

From: family-historian@groups.io <family-historian@groups.io> On Behalf Of Graham Conner via Groups.Io
Sent: 11 February 2020 15:37
To: family-historian@groups.io
Subject: [family-historian] =TextIf function not working properly?

 

Hi,

I have been using Family Historian for some time and been using my own Sentence Templates without problems. As I use both Place and Address data with the administrative location in the Place and postal address in the Address field, I wanted to be able to display or print out the address if it has been entered and if not display or print the place.  This is what I am trying to use in the Sentence Template for the Birth as an example.

 

<para>{%CUR_PRIN.NAME[1]:FULL%} was born {date} <at {=TextIf(Exists(%FACT.ADDR%),TextPart(%FACT.ADDR%,1,5,Tidy),TextPart(%FACT.PLAC%,1,5, Tidy))} > <({age})>

 

The TextIf seems to be broken, or I am not using it correctly and I am not sure which.  The above results in the Address being displayed if it has been entered, which is correct,  but if there is no Address, then it does not print out the Place. I end up with just the Name and Date of Birth and then nothing else.

 

I have tried cut and pasting examples from the Help screens to see if something simple would work, but these do not work either.

 

I have Family Historian 6.2.7 installed on a PC running Windows 10 and all the latest updates. I have tried reinstalling FH, and tested it on another PC. I get the same results.

 

Best Regards,

Graham

 


Graham Conner
 

Thanks Mike, that works!

What you said makes sense. I could not understand why the examples did not work, but as I was only deleting the data to test they would fail for me too. I thought thesolution would be something simple.  Brilliant I have lots of modifications I wanted to do and including the "In and at" modification that I had planned to do.  

Is there a limit to the length of command strings you can have in the Sentence Templates?  

Regards, Graham


Mike Tate
 

Graham,

 

I am not aware of any length limit to Sentence Templates, and I have some quite long ones, especially where Fact Witness Roles are involved.

 

Users have discovered length limits for expressions in some other contexts, reported them to Calico Pie, and most have been rectified.

 

Regards, Mike Tate

 

From: family-historian@groups.io <family-historian@groups.io> On Behalf Of Graham Conner via Groups.Io
Sent: 11 February 2020 17:39
To: family-historian@groups.io
Subject: Re: [family-historian] =TextIf function not working properly?

 

Thanks Mike, that works!

What you said makes sense. I could not understand why the examples did not work, but as I was only deleting the data to test they would fail for me too. I thought thesolution would be something simple.  Brilliant I have lots of modifications I wanted to do and including the "In and at" modification that I had planned to do.  

Is there a limit to the length of command strings you can have in the Sentence Templates?  

Regards, Graham


Graham Conner
 

Thanks again, Mike

Regards, Graham


Mike Tate
 

I have to admit to a minor mistake in my earlier Sentence Template for displaying Address or Place names.

If neither Address nor Place exist then it still displays the word “in “ on its own, and the expression should have been:

{=CombineText( "at ", TextPart(%FACT.ADDR%,1,5,Tidy), , CombineText( "in ", TextPart(%FACT.PLAC%,1,5,Tidy), , ) )}

i.e.

If the Address field exists then combine it with the “at “ prefix, else if the Place field exists combine it with the “in “ prefix, else display nothing.

In other words the CombineText(…) function is very similar to < angle brackets > but has the added option to display something when the key field does not exist.

 

Sorry for the mistake, Mike Tate

 

From: family-historian@groups.io <family-historian@groups.io> On Behalf Of Graham Conner via Groups.Io
Sent: 11 February 2020 19:03
To: family-historian@groups.io
Subject: Re: [family-historian] =TextIf function not working properly?

 

Thanks again, Mike

Regards, Graham

 


Graham Conner
 

Hi Mike,
I was wondering about that and was just testing the same fix when your message arrived!
Cheers,
Graham