* Simple Query Problem - error with Contains Operator? in Query

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
tparkhill
Platinum
Posts: 48
Joined: 08 Dec 2020 17:46
Family Historian: V7

Simple Query Problem - error with Contains Operator? in Query

Post by tparkhill » 11 Jul 2022 21:44

Just starting on Queries (but I have experience with Boolean Queries). Wanted to find my Palatine immigrant Ancestors, so wanted to search for all people born in Germany during a certain time period, but who did not die in Germany. So I started with . . . Add if %INDI.BIRT[1].PLAC>% contains 'Germany'. This seemed to work.
Then I added . . . Exclude if %INDI.EVEN-DEATH[1].PLAC>% contains 'Germany'
However, there were still people where Germany was part of the death Place when I ran query.
I don't understand why this does not work ??
I checked spelling and Germany spelled correctly was showing up in the Death Place

I then tried . . . Exclude unless %INDI.DEAT[1].PLAC>% contains 'New York'
That DID seem to find people born in Germany who died in New York.
And so if all my Palatine relatives died in New York, then I am OK.
BUT
1) to make sure I am understanding your query engine, I would still like to understand why the Exclude on Death Place in Germany does not work. and
2) Also, some of my place names might just have "NY" vs. "New York", to do this, it would seem like I need something like . .
Exclude unless %INDI.DEAT[1].PLAC>% contains 'New York' OR 'NY" But I can't see how to enter that .?
3) since I have imported data from other sources, I have several Alternate Death Date fields, that I would have to also consider. I am guessing I would have to do several separate queries and combine in Excel to figure this out (eventually I have to clean up Birth and Death dates so there are only say 2 possible fields for each.

Thanks!!
Trent
FH7 . . . and loving it :D

User avatar
LornaCraig
Megastar
Posts: 2996
Joined: 11 Jan 2005 17:36
Family Historian: V7
Location: Oxfordshire, UK

Re: Simple Query Problem - error with Contains Operator? in Query

Post by LornaCraig » 11 Jul 2022 22:13

1. Your line Exclude if %INDI.EVEN-DEATH[1].PLAC>% contains 'Germany' is not valid. It should be Exclude if %INDI.DEAT[1].PLAC>% contains 'Germany'

2. I think you would need to reverse the order. So start by adding those people whose death place contains 'New York', then add those whose death place contains 'NY', and finally exlcude unless their birth place contains 'Germany'.
Lorna

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

Re: Simple Query Problem - error with Contains Operator? in Query

Post by tatewise » 12 Jul 2022 09:37

There is a potential problem with Add if %INDI.DEAT.PLAC>% contains 'NY'
The contains operator must have Match case ticked to check for capital N and capital Y otherwise case is ignored.
It will match 'NY' that appears anywhere in the Place field within any word so it would match ANYWHERE.

The same risks might arise with other Place names.
e.g. Add if %INDI.DEAT.PLAC>% contains 'England' would match the New England USA state as well as the country.

The better solution is to use the =TextPart(...) function to extract the country comma-separated part.
i.e.
Add if =TextPart(%INDI.DEAT.PLAC%,-1) matches 'England' assuming countries are always the last part.
Add if =TextPart(%INDI.DEAT.PLAC%,-2) matches 'NY' assuming US states are always the penultimate part.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
tparkhill
Platinum
Posts: 48
Joined: 08 Dec 2020 17:46
Family Historian: V7

Re: Simple Query Problem - error with Contains Operator? in Query

Post by tparkhill » 13 Jul 2022 15:18

Thank you both so much!
I now see my error on the field name.
I also see the challenge on "England" . . . which you correctly anticipated was my next search.

My father entered ~9000 records in the 90s and I have imported other records from a variety of people. My task now is "clean up". I have to do a LOT of cleaning up and standardizing of place names.

Its a very intimidating task. I wish there was a Plugin that compared all place names to standard ones (say in Google's Geocoding) and then bought suggested standard names one by one so I could accept or reject. That would not fix all problems but speed up much of the perhaps 30k to 40k place names.
Again, thank you so much for your help!
Trent

Post Reply