I have a custom query which looks for clergy in the occupation field. A typical line is
Add if "occupation" contains 'Rector'
This also adds people with occupations such as a Director. I would like to be able to only add if the complete word is 'rector'
I imagine a tick box alongside "Match case" labelled "Whole word only"
I cannot use 'matches' instead of 'contains' as the field may say something like Rector Luccombe, Somerset bef1851-1869
Match case: There is no guarantee that I have always spelt rector with a capital r.
(Other occupations included are Reverend, Parson, Vicar, Bishop, Minister, Dean, Clergy, Clerk in Holy Orders, Curate, Chaplain)
* Custom queries - ability to select only if complete word
Custom queries - ability to select only if complete word
Seeker
FH 7.0.17.1 on Windows 10 Home
FH 7.0.17.1 on Windows 10 Home
- tatewise
- Megastar
- Posts: 27082
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Custom queries - ability to select only if complete word
Please confirm you are using Query Type: Fact and not Individual.
Otherwise you will not be testing all Occupations where a person has more than one Occupation Attribute.
First of all I don't think the Occupation field will contain Rector Luccombe, Somerset bef1851-1869 because that looks like the =GetDisplayText(%FACT%,STD) of Occupation + Place + Date.
You need to be testing the Expression: =FactValue(%FACT%) which will be just Rector, Reverend, Parson, Director, etc.
In addition to Operator: contains and matches there are begins with and ends with that may be useful.
However, since you will now only be testing the Occupation value, the Operator: matches should work OK.
Otherwise you will not be testing all Occupations where a person has more than one Occupation Attribute.
First of all I don't think the Occupation field will contain Rector Luccombe, Somerset bef1851-1869 because that looks like the =GetDisplayText(%FACT%,STD) of Occupation + Place + Date.
You need to be testing the Expression: =FactValue(%FACT%) which will be just Rector, Reverend, Parson, Director, etc.
In addition to Operator: contains and matches there are begins with and ends with that may be useful.
However, since you will now only be testing the Occupation value, the Operator: matches should work OK.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
- tatewise
- Megastar
- Posts: 27082
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Custom queries - ability to select only if complete word
A second option is to use the Search and Replace Plugin in Search ONLY mode.
On its Extra Filters tab, untick everything to Exclude All Short/Long Text & Distinctive Fields.
Then tick just Fact Attribute values and select Occupation (INDI.OCCU).
On its Major Options tab, ensure Plain Text Mode, Case Insensitive, and Whole Words are chosen.
(Although other choices may be appropriate in other cases).
Ensure Search Scope is either All Records & Events/Attributes or Individual Records (INDI) or even Occupation (INDI.OCCU).
In the Search box enter the occupation to be found, such as Rector.
Click the Search ONLY button, and in the subsequent dialogue click Report, and when happy all is OK, untick Confirm every item found and click Report again.
The Plugin will produce a Result Set of all matching records, and by double clicking any Data Value cell, will open its Property Box.
(Note that those Plugin settings can be saved in a Preset lower left, for future ease of use.)
If that Plugin Result Set does not provide sufficient column details, then this is what to do:
Select all the rows, and in the Query Menu choose Add Selected Cell Records to Named List, say Key Individuals.
Back in your Custom Query set your Rows filter to include:
Add if =IsInList( GetRecord(%FACT%), "Key Individuals" ) is true
(or whatever Name List you prefer to use.)
It sounds a bit tedious, but once set up is remarkably quick, and is easily adaptable to search for other details without creating a new Query each time.
On its Extra Filters tab, untick everything to Exclude All Short/Long Text & Distinctive Fields.
Then tick just Fact Attribute values and select Occupation (INDI.OCCU).
On its Major Options tab, ensure Plain Text Mode, Case Insensitive, and Whole Words are chosen.
(Although other choices may be appropriate in other cases).
Ensure Search Scope is either All Records & Events/Attributes or Individual Records (INDI) or even Occupation (INDI.OCCU).
In the Search box enter the occupation to be found, such as Rector.
Click the Search ONLY button, and in the subsequent dialogue click Report, and when happy all is OK, untick Confirm every item found and click Report again.
The Plugin will produce a Result Set of all matching records, and by double clicking any Data Value cell, will open its Property Box.
(Note that those Plugin settings can be saved in a Preset lower left, for future ease of use.)
If that Plugin Result Set does not provide sufficient column details, then this is what to do:
Select all the rows, and in the Query Menu choose Add Selected Cell Records to Named List, say Key Individuals.
Back in your Custom Query set your Rows filter to include:
Add if =IsInList( GetRecord(%FACT%), "Key Individuals" ) is true
(or whatever Name List you prefer to use.)
It sounds a bit tedious, but once set up is remarkably quick, and is easily adaptable to search for other details without creating a new Query each time.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
- tatewise
- Megastar
- Posts: 27082
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Custom queries - ability to select only if complete word
In the specific case of Occupations (and the other Tools > Work with Data lists) then those lists offer another way of finding particular values.
The original user, and nobody else, has commented on the alternative methods offered, so if there is no further interest, this will be moved to the FH General Usage Forum.
The original user, and nobody else, has commented on the alternative methods offered, so if there is no further interest, this will be moved to the FH General Usage Forum.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry