* Place and address sentence construction
Place and address sentence construction
As a former TMG user, the sentence construction is presenting a few issues for me in FH6. I have adopted an approach of 3 columns for place and 7 columns for address. The place forms part of the 7 columns for the address. This enables more effective sorting of events by location and allocation of events by address and place.
However, in creating and modifying sentences for events this approach presents challenges to construct suitable sentences. I have experimented with the sentences construction to improve its readability.
Option 1 below is provides the full address. However, if you only know the place and not the address it requires the place to be duplicated as an address.
{date} {individual} lived <at {address}> <with {other=resident}>
Option 2 below provides an effective narrative. However, using 7 columns in the address including the place the sentence is compromised.
{date} {individual} lived <at {address}> {place} <with {other=resident}>
The solution is to reduce the 7 columns to 4 for the address. However, mean that a building such as a Methodist Church where you may not have a street address may have multiple places attached to this. Alternatively you may only have a street name that is common to a number of places.
However, if you could identify the first four columns of the address it would facilitate the following sentence construction. An example this approach in a sentence would be
{date} {individual} lived <at {address1} {address2} {address3} {address4}> {place} <with {other=resident}>
Is there a way to retain the 7 columns but extract the first 4 columns of the address for the sentence? Does anyone have any other ideas on how to approach this challenge?
However, in creating and modifying sentences for events this approach presents challenges to construct suitable sentences. I have experimented with the sentences construction to improve its readability.
Option 1 below is provides the full address. However, if you only know the place and not the address it requires the place to be duplicated as an address.
{date} {individual} lived <at {address}> <with {other=resident}>
Option 2 below provides an effective narrative. However, using 7 columns in the address including the place the sentence is compromised.
{date} {individual} lived <at {address}> {place} <with {other=resident}>
The solution is to reduce the 7 columns to 4 for the address. However, mean that a building such as a Methodist Church where you may not have a street address may have multiple places attached to this. Alternatively you may only have a street name that is common to a number of places.
However, if you could identify the first four columns of the address it would facilitate the following sentence construction. An example this approach in a sentence would be
{date} {individual} lived <at {address1} {address2} {address3} {address4}> {place} <with {other=resident}>
Is there a way to retain the 7 columns but extract the first 4 columns of the address for the sentence? Does anyone have any other ideas on how to approach this challenge?
Garry Keath
- tatewise
- Megastar
- Posts: 27088
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Place and address sentence construction
What you have overlooked is the ability to use Expressions composed of Functions and Data Refs as explained in the Advanced Help. See also how_to:understanding_expressions|> Understanding Expressions.
So in the simplest case I suggest that if an Address exists then display that, otherwise display the Place.
e.g.
{=TextIf( Exists(%FACT.ADDR%), Text("at " . %FACT.ADDR%), Text("in " . %FACT.PLAC%) )}
This suffers from a problem if there is no Place field as it will just display "in ".
So Text("in " . %FACT.PLAC%) must be replaced by a nested TextIf( ) function.
e.g.
TextIf( Exists(%FACT.PLAC%), Text("in " . %FACT.PLAC%), "" )
Your later question about extracting Address (or Place) columns is handled by the TextPart() function, but you may not need that.
So in the simplest case I suggest that if an Address exists then display that, otherwise display the Place.
e.g.
{=TextIf( Exists(%FACT.ADDR%), Text("at " . %FACT.ADDR%), Text("in " . %FACT.PLAC%) )}
This suffers from a problem if there is no Place field as it will just display "in ".
So Text("in " . %FACT.PLAC%) must be replaced by a nested TextIf( ) function.
e.g.
TextIf( Exists(%FACT.PLAC%), Text("in " . %FACT.PLAC%), "" )
Your later question about extracting Address (or Place) columns is handled by the TextPart() function, but you may not need that.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Place and address sentence construction
Hi Mike
Thanks for the advice, albeit it rather late. Based on your advice I read more on expressions functions and Data Refs. Based on your guidance and my reading, I re-worked the sentence structure in vital facts and residences using TextPart. Below are examples of the changes.
Residence fact
<{date},> {individual} lived <at {=TextPart(%FACT.ADDR%, 1, 4, TIDY)}> {place} <with {other=resident}>
Birth fact
{individual} was born {date} <at {=TextPart(%FACT.ADDR%, 1, 4, TIDY)}> {place} <({age})>
It is works well.
Thanks for the advice, albeit it rather late. Based on your advice I read more on expressions functions and Data Refs. Based on your guidance and my reading, I re-worked the sentence structure in vital facts and residences using TextPart. Below are examples of the changes.
Residence fact
<{date},> {individual} lived <at {=TextPart(%FACT.ADDR%, 1, 4, TIDY)}> {place} <with {other=resident}>
Birth fact
{individual} was born {date} <at {=TextPart(%FACT.ADDR%, 1, 4, TIDY)}> {place} <({age})>
It is works well.
Garry Keath
- tatewise
- Megastar
- Posts: 27088
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Place and address sentence construction
They look good, but I suggest you move some of the space characters inside the < brackets > otherwise you may get multiple space characters when some of the < items > are empty.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Place and address sentence construction
Hi Mike
Thanks, for that input. I can see what you mean with the spaces inside the bracket.
Thanks, for that input. I can see what you mean with the spaces inside the bracket.
Garry Keath
- SpencerDudeUK
- Diamond
- Posts: 91
- Joined: 01 Jun 2018 15:07
- Family Historian: V7
Re: Place and address sentence construction
I have a problem with the code given in the previous answer, since I can't get the if, then, else to work for the 'else' case...
My code:
{individual} was living {=TextIf( Exists(%FACT.ADDR%), Text("at " . %FACT.ADDR%), TextIf(Exists(%FACT.PLAC%), Text("in " . %FACT.PLAC%), ""))}
which to me says "If there's an address then use it, else if there is no address, then use the place, else don't print the 'in'.
Testing this, if I have a place and an address, it displays the address correctly, but if I remove the address, I don't get the place, and still get the 'at.' on the end (It also stays the same if I remove the Place as well). Note it's the 'at' not the 'in' that remains, which is still the first 'then' part of the statement to do with the address.
It seems to be ignoring the 'else' part of the argument altogether, but I'm using the example in the previous answers and I can't see any syntax errors...?
My code:
{individual} was living {=TextIf( Exists(%FACT.ADDR%), Text("at " . %FACT.ADDR%), TextIf(Exists(%FACT.PLAC%), Text("in " . %FACT.PLAC%), ""))}
which to me says "If there's an address then use it, else if there is no address, then use the place, else don't print the 'in'.
Testing this, if I have a place and an address, it displays the address correctly, but if I remove the address, I don't get the place, and still get the 'at.' on the end (It also stays the same if I remove the Place as well). Note it's the 'at' not the 'in' that remains, which is still the first 'then' part of the statement to do with the address.
It seems to be ignoring the 'else' part of the argument altogether, but I'm using the example in the previous answers and I can't see any syntax errors...?
- tatewise
- Megastar
- Posts: 27088
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Place and address sentence construction
There are no syntax errors, but you are not deleting the Address completely.
You are deleting the contents of the ADDR field, but the empty tag still exists.
You either need to close and re-open FH, or switch to another Project and back, or the easiest method is to open the All tab in the Property Box, navigate to the desired Address entry, and delete that.
You are deleting the contents of the ADDR field, but the empty tag still exists.
You either need to close and re-open FH, or switch to another Project and back, or the easiest method is to open the All tab in the Property Box, navigate to the desired Address entry, and delete that.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
- SpencerDudeUK
- Diamond
- Posts: 91
- Joined: 01 Jun 2018 15:07
- Family Historian: V7
Re: Place and address sentence construction
I have closed and reopened the project, and checked the 'All' tab which now shows a place but not an address, and it works, so once again, a big thanks for the help. I would have thought, though, that there should have been a simple function key to update the empty field, like F5 or F9, but still, these idiosyncrasies catch you out now and again.
Thanks again
Thanks again