* Modifying "Contains Text" Standard 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
rfj1001
Superstar
Posts: 291
Joined: 14 Dec 2003 18:11
Family Historian: V7
Location: Dorset, England
Contact:

Modifying "Contains Text" Standard Query

Post by rfj1001 »

I'm trying to find anyone who was born or might have lived/married/died/etc in Egremont, Cumberland. It is not set up as a place name so I thought of just searching on the two words.

Using the standard contains text query as a starting point where I can enter the county name I've then been trying to add an "Exclude Unless" second line with the option of then entering the second search word, Egremont. But I can't get the correct syntax.

Any help would be appreciated.

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

Re: Modifying "Contains Text" Standard Query

Post by tatewise »

The syntax is identical to the Add if Rows filter but with Condition: Exclude unless.
Do you want explicit search text Egremont and Cumberland, or parameter prompts?

Have you checked the FH Help > Search Help for "Contains Text" with the quotes, and click List Topics.

Select the Add if filter, on Condition drop list choose Exclude unless, change the text parameter, and click Add button.

Exclude unless =ContainsText( , ["Enter Text 2"], EXT ) is true to prompt for text
or
Exclude unless =ContainsText( , "Egremont", EXT ) is true for explicit text

However, all that is superfluous as you can simply enter both words Egremont Cumberland into the Standard Query and it will only list the records where both words exist in any order anywhere.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
davidf
Megastar
Posts: 951
Joined: 17 Jan 2009 19:14
Family Historian: V6.2
Location: UK

Re: Modifying "Contains Text" Standard Query

Post by davidf »

What exactly do you mean by "Egremont, Cumberland. It is not set up as a place name"?

If you have entered "Egremont" in any place field for any fact, the "place" is set up. If you have not entered "Egrement" in any place field, where is it entered in FH? In a transcription in a fact, citation or source note?

You need to know where you have put it so that you can instruct an FH query to search those fields.

Even though you are trying to "find anyone" (Individuals), you need to think indirectly. You need to query any Fact that contains "Egremont" and find out who "owns the fact". So you want a Fact based Query. Sadly you cannot (or at least I can't) just query the fact; you have to query the Fact parameter (Date, Place, Address, Note2 etc.) - which is why you need to know where you expect to find "Egremont". If you select Fact when setting up your query you will automatically get some columns, you probably need to add Place and Address Columns (and possibly others - depending on where you think FH may be holding the word "Egremont")

If you have entered "Egremont" in a place field, in the Query Row Tab you will want "Exclude unless" "%FACT.PLAC>%" "contains" "Egremont". You can possibly more usefully rather than enter Egremont as the Value, instead click the parameter box, which means when you run the query you will be prompted for the place.

Be aware that there is an Egremont in Cheshire as well as Cumberland. Searching on just "Egremont" could bring up both (and possibly others), but is probably safer until you are sure how you have entered "Egremont, Cumberland" ("Egremont Cumberland" or "Egremont, Cumberland" or even "Egremont Cumbria" etc.) to search for Egremont and get too many results rather than too few.
David
Running FH 6.2.7. Under Wine on Linux (Ubuntu 22.04 LTS + LXDE 11)
User avatar
tatewise
Megastar
Posts: 28403
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Modifying "Contains Text" Standard Query

Post by tatewise »

@David, the =ContainsText(...) function does more than I suspect you realise.
It searches ALL text fields in the Individual record, and any Spouse Family records, and any linked Note records.
So that will include all the Facts and Citations and their associated fields (but not Source records).

Thus if both Egremont and Cumberland are found in the above context, the Individual will be listed.

As an example, run the Standard Query Contains Text in the FH Sample Project with search text hospital cheltenham.
It will only list a few Individuals that mention both cheltenham and hospital even though many more mention those words on their own.

FYI: You can perform Fact based Queries by using a Fact type Query.
See how_to:creating_a_query|> Creating a Query that explains the many Types of Query.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
davidf
Megastar
Posts: 951
Joined: 17 Jan 2009 19:14
Family Historian: V6.2
Location: UK

Re: Modifying "Contains Text" Standard Query

Post by davidf »

Thanks, I had not realised the scope of ContainsText (which is why I was sad in my last post :( ) I had tried %FACT% contains "parameter".

The standard Contains Text Query is Individual based so just returns the Individuals (which may be all that is desired).

But if you set it up as a Fact based Query you can get "how" (born, married, resident etc.) the Individual was associated with a "place" (or more accurately a text string that may represent a place or something else - Cheltenham as in Place or as in the Cheltenham and Gloucester Building Society branch in Durham for example). The Fact based query avoids (or at least shows) any spurious associations.
David
Running FH 6.2.7. Under Wine on Linux (Ubuntu 22.04 LTS + LXDE 11)
User avatar
Jane
Site Admin
Posts: 8513
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Re: Modifying "Contains Text" Standard Query

Post by Jane »

Don't forget the standard Find option on the edit menu, that will search everything and there is an option to drop the results to a Result set.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
User avatar
tatewise
Megastar
Posts: 28403
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Modifying "Contains Text" Standard Query

Post by tatewise »

@Jane ~ I tried the Edit > Find but it does not work like =ContainsText when searching for two (or more) words that may occur in various fields. Find only matches contiguous text, so the two words must occur together in correct order.

@davidf ~ Yes, a Fact Query would give a better context, but it does not search Names, or record level Notes or linked Note records, nor the many other non-Fact fields. Also, the two words would have to occur within one Fact so it would miss other cases.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
rfj1001
Superstar
Posts: 291
Joined: 14 Dec 2003 18:11
Family Historian: V7
Location: Dorset, England
Contact:

Re: Modifying "Contains Text" Standard Query

Post by rfj1001 »

Thanks Mike,

Yes I had checked help /and/ the forum threads /and/ the knowledge base /and/ the FH book which is something I always do before I post.

I hadn't appreciated the standard contains text query was so powerful so, as you suggested, I just entered my two words and got the result :).

Going back to the syntax of the second Excludeif expression, I had got it correct. It is just that when I entered it, the Add or Modify buttons were greyed out. I even tried copying and pasting the expression direct from your post but got the same result. So not sure what was going on there
User avatar
tatewise
Megastar
Posts: 28403
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Modifying "Contains Text" Standard Query

Post by tatewise »

Regarding the Query 2nd Rows tab filter, you must have got the syntax wrong. That is why the buttons are greyed out.
If you know the following advice, then I apologise...

You cannot paste the entire Exclude unless =ContainsText( , "Egremont", EXT ) is true into the Expression box.

You must use the Condition droplist to choose Exclude unless.
Paste =ContainsText( , "Egremont", EXT ) into the Expression box ensuring brackets & quotes are in matched pairs, correct number of commas, leading = sign, etc.
Use Operator droplist to choose is true.

When all is OK the Add and Update buttons will become enabled.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Post Reply