* Finding text using expressions

Requests that have been moved to the Wish List, or deemed to need no further action
Post Reply
avatar
JonAxtell
Superstar
Posts: 481
Joined: 28 Nov 2006 09:59
Family Historian: None

Finding text using expressions

Post by JonAxtell » 18 Jun 2009 12:56

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

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

Finding text using expressions

Post by Jane » 18 Jun 2009 14:28

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.
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
JonAxtell
Superstar
Posts: 481
Joined: 28 Nov 2006 09:59
Family Historian: None

Finding text using expressions

Post by JonAxtell » 18 Jun 2009 15:07

Thanks for having a go, and moving the post.

avatar
PatrickT
Diamond
Posts: 86
Joined: 08 Apr 2006 13:46
Family Historian: V6.2

Finding text using expressions

Post by PatrickT » 19 Jun 2009 10:00

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?

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

Finding text using expressions

Post by Jane » 19 Jun 2009 11:55

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."

User avatar
PeterR
Megastar
Posts: 1129
Joined: 10 Jul 2006 16:55
Family Historian: V7
Location: Northumberland, UK

Finding text using expressions

Post by PeterR » 27 May 2010 17:00

I find I am able to use the following expression successfully in a diagram boxes condition:

Code: Select all

=ContainsText(%INDI.BIRT.PLAC%,'Staff',STD)
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[2].PLAC%,'Staff',STD)
Peter Richmond (researching Richmond, Bulman, Martin, Driscoll, Baxter, Hall, Dales, Tyrer)

User avatar
SimonOrde
Program Designer
Posts: 352
Joined: 18 Nov 2002 10:20
Family Historian: V7
Location: Calico Pie

Finding text using expressions

Post by SimonOrde » 28 May 2010 11:50

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.

User avatar
PeterR
Megastar
Posts: 1129
Joined: 10 Jul 2006 16:55
Family Historian: V7
Location: Northumberland, UK

Finding text using expressions

Post by PeterR » 28 May 2010 12:00

Thanks for the confirmation, Simon.

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))
I think this and the many other improvements should help convince even more users to upgrade to FH version 4.1.
Peter Richmond (researching Richmond, Bulman, Martin, Driscoll, Baxter, Hall, Dales, Tyrer)

Post Reply