Page 1 of 1

Finding text using expressions

Posted: 18 Jun 2009 12:56
by JonAxtell
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

Finding text using expressions

Posted: 18 Jun 2009 14:28
by Jane
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.

Finding text using expressions

Posted: 18 Jun 2009 15:07
by JonAxtell
Thanks for having a go, and moving the post.

Finding text using expressions

Posted: 19 Jun 2009 10:00
by PatrickT
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?

Finding text using expressions

Posted: 19 Jun 2009 11:55
by Jane
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.

Finding text using expressions

Posted: 27 May 2010 17:00
by PeterR
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)

Finding text using expressions

Posted: 28 May 2010 11:50
by SimonOrde
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.

Finding text using expressions

Posted: 28 May 2010 12:00
by PeterR
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.