* Finding text using expressions
Finding text using expressions
I've had a good look, but either I'm having a bit of a male moment (can't see what's under my nose) or it's not possible.
What I want is to use an expression to check if a particular event's place contains some text. I know there is the ContainsText() function but this checks the whole record without regard to the which event or field the text is in. ExistsText() only checks if the field contains something or nothing.
Something like =ContainsText(%INDI.BIRT[1].PLAC%, ', UK') would be the ideal function to check if someone was born in the UK.
If such a function existed, then I wouldn't have to use flags to place country icons on my diagrams, which also means that changing a place doesn't need me to ALSO change the flag.
Is there some complex mixing of functions that would provide a similar feature or I am going to have to make a wish list request.
Edit: Looking at the wish list I see that item 182 is similar to what I am looking for.
ID:3835
What I want is to use an expression to check if a particular event's place contains some text. I know there is the ContainsText() function but this checks the whole record without regard to the which event or field the text is in. ExistsText() only checks if the field contains something or nothing.
Something like =ContainsText(%INDI.BIRT[1].PLAC%, ', UK') would be the ideal function to check if someone was born in the UK.
If such a function existed, then I wouldn't have to use flags to place country icons on my diagrams, which also means that changing a place doesn't need me to ALSO change the flag.
Is there some complex mixing of functions that would provide a similar feature or I am going to have to make a wish list request.
Edit: Looking at the wish list I see that item 182 is similar to what I am looking for.
ID:3835
- Jane
- Site Admin
- Posts: 8441
- Joined: 01 Nov 2002 15:00
- Family Historian: V7
- Location: Somerset, England
- Contact:
Finding text using expressions
Sorry John, can't find a way. I did try a few options to see if I could fool it in to taking a Data Reference rather than a record, but it was not having it.
I'll move this to the wish list. I think 182 is pretty similar. Providing a function like ContainsText for a data reference would do it.
I'll move this to the wish list. I think 182 is pretty similar. Providing a function like ContainsText for a data reference would do it.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
Finding text using expressions
Thanks for having a go, and moving the post.
Finding text using expressions
Can't you achieve something like you want by using row filter parameters? I have queries set up to display events by place using filters like:
Add if%INDI.BIRT[1].PLAC% contains ['Birthplace']
where 'Birthplace' is a parameter.
Possibly, this isn't what you are looking for?
Add if%INDI.BIRT[1].PLAC% contains ['Birthplace']
where 'Birthplace' is a parameter.
Possibly, this isn't what you are looking for?
- Jane
- Site Admin
- Posts: 8441
- Joined: 01 Nov 2002 15:00
- Family Historian: V7
- Location: Somerset, England
- Contact:
Finding text using expressions
Patrick, if can be done in queries easily enough, John was trying to condition icons on diagrams, with an expression rather than going via a query to set flags.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
- PeterR
- Megastar
- Posts: 1129
- Joined: 10 Jul 2006 16:55
- Family Historian: V7
- Location: Northumberland, UK
Finding text using expressions
I find I am able to use the following expression successfully in a diagram boxes condition:Perhaps this is new in v4.1.2? To cater for a 2nd birth event, you can add another condition:
Code: Select all
=ContainsText(%INDI.BIRT.PLAC%,'Staff',STD)Code: Select all
=ContainsText(%INDI.BIRT[2].PLAC%,'Staff',STD)Peter Richmond (researching Richmond, Bulman, Martin, Driscoll, Baxter, Hall, Dales, Tyrer)
- SimonOrde
- Program Designer
- Posts: 352
- Joined: 18 Nov 2002 10:20
- Family Historian: V7
- Location: Calico Pie
Finding text using expressions
Peter - you're right, this is new in 4.1. Previously 'ContainsText' could only be used with records. Now it can be used with any data item. I notice that we somehow failed to list it as one of the new features in the 'What's new in 4.1' page on the FH website, but I've now added it there.
- PeterR
- Megastar
- Posts: 1129
- Joined: 10 Jul 2006 16:55
- Family Historian: V7
- Location: Northumberland, UK
Finding text using expressions
Thanks for the confirmation, Simon.
I should have mentioned also that two conditions can of course be combined, e.g.:I think this and the many other improvements should help convince even more users to upgrade to FH version 4.1.
I should have mentioned also that two conditions can of course be combined, e.g.:
Code: Select all
=IsTrue(ContainsText(%INDI.BIRT.PLAC%,'Bark',STD) or ContainsText(%INDI.BIRT[2].PLAC%,'Bark',STD))Peter Richmond (researching Richmond, Bulman, Martin, Driscoll, Baxter, Hall, Dales, Tyrer)