* Places - Checking for Country

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
quarlton
Famous
Posts: 150
Joined: 26 Feb 2004 13:07
Family Historian: V7
Location: Lincolnshire
Contact:

Places - Checking for Country

Post by quarlton » 06 Nov 2019 12:59

Every month I run a set of queries looking for various errors.
One of these checks that I have a valid Country in 'Places'.

Now because the country name could appear in any of 4 levels I need to check each of those places.
e.g.

Brazil
Essex, England
Liverpool, Lancashire, England
Beckside, Kirby Ireleth, Lancashire, England

So my query looks at all 'Places' but excludes those that have a valid country:

Exclude if =TextPart(%_PLAC%,1,1,STD)matches 'Australia'
Exclude if =TextPart(%_PLAC%,2,1,STD)matches 'Australia'
Exclude if =TextPart(%_PLAC%,3,1,STD)matches 'Australia'
Exclude if =TextPart(%_PLAC%,4,1,STD)matches 'Australia'


This is obviously repeated for every country that is in use.

The result is a list of 'Places' created without a Country name - or with a new one.

My existing query works fine, but I've just imported some new records with places missing country or have a previously unknown one, and I have to modify it and thought it may be right time to see if anyone had a better idea.

Many thanks
Dave Simpson ~ Boulton, Braham, Carney, Simpson and Jacobs

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

Re: Places - Checking for Country

Post by tatewise » 06 Nov 2019 14:18

You could make things a lot easier for yourself by making every Place use a fixed number of column parts.
In your case use Tools > Worth with Data > Places and use Columns button to set 4 column parts.
They would be designated something like Region, Town, County, Country.

Then reorganise each Place name to use 4 columns so your examples would become:
, , , Brazil
, , Essex, England
, Liverpool, Lancashire, England
Beckside, Kirby Ireleth, Lancashire, England

Those changes must be made in the Place records via the Places tab of the Records Window.
Or you could use the Rearrange Address and Place Parts Plugin and select the Right justify all Place parts option.
Don't worry about the extraneous blank columns as in most Diagrams and Reports they get tidied away.

Then in Tools > Worth with Data > Places it is easier to see if column 4 has a valid Country by sorting on that column.
If you wish to keep using your Query then it only needs one Row filter Expression per Country.

Just make sure all new records use the 4 column format, especially when importing from a GEDCOM, where you should correct the format before importing to your main Project.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
Jane
Site Admin
Posts: 8442
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Re: Places - Checking for Country

Post by Jane » 06 Nov 2019 14:23

I would assume the country should always be the last field in the place so you could simply use

Code: Select all

=TextPart(%_PLAC%,-1) matches 'Australia'
Which will return the last element. You then only need one line for each country.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

avatar
quarlton
Famous
Posts: 150
Joined: 26 Feb 2004 13:07
Family Historian: V7
Location: Lincolnshire
Contact:

Re: Places - Checking for Country

Post by quarlton » 06 Nov 2019 14:49

Mike, Jane

Many thanks for your quick responses.

Jane - Your solution to the query issue works fine and I have modified my query accordingly, thank you.

Mike - Your option also works very well, especially with the mass import, unfortunately for daily use it still relies on my data inputting skills, which is where the initial problem lies. :D I have some more data to import and will use your method for that.

Again, many thanks to you both.
Dave Simpson ~ Boulton, Braham, Carney, Simpson and Jacobs

Post Reply