dbTalk Databases Forums  

Any way to search for exact phrase within other text?

comp.databases.filemaker comp.databases.filemaker


Discuss Any way to search for exact phrase within other text? in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
W Brent Simon
 
Posts: n/a

Default Re: Any way to search for exact phrase within other text? - 04-29-2005 , 03:18 PM






There's always a way.

I havent worked this out fully, but what if.....

you added 3 fields....


1) NameLength - Length of the field that "Black Bear" resides

2) NameFindGlobal - A global field that stores the find request.

3) LengthNameFindGlobal - Length of the value in NameFindGlobal


and then when you did the find request, you would find "Black Bear" and
length of "Black Bear" "10".

I know this is real sketchy, but maybe someone can run with this. If not,
I can work out the details shortly.













"dpmoyd" <dpmoyd (AT) yahoo (DOT) com> wrote in news:1114644468.852882.102370
@f14g2000cwb.googlegroups.com:

Quote:
I'm trying to create a script that performs a search in a text field.
I need to know if there is any way to perform a find for records
containing a specific phrase amongst everything else in that field.
However, this isn't simply a literal phrase search - see the example
below, because this is difficult to explain (and probably why I've
spent all day trying to do it with no success).

Example:
Two records have the following information in the "type" field:

Record 1:
Brown Bear
Black Bear
Black Monkey

Record 2:
Brown Bear
Black Bear Cub

I need to do a search for "Black Bear" that *only* returns Record 1,
and not Record 2. If I do a search using the criteria "Black Bear" or
=Black Bear it will return both records. If I do a search using the
criteria ==Black Bear it will return zero records.

Is there *any* way to do a search that only returns the one record? I
imagine there will have to be some text parsing involved, but I cannot
necessarily guarantee what character will appear before and after the
desired search string.

Thanks,
DPM



Reply With Quote
  #12  
Old   
Howard Schlossberg
 
Posts: n/a

Default Re: Any way to search for exact phrase within other text? - 04-29-2005 , 03:36 PM






This time, I've had both coffee and lunch.

Create a stored/indexed calc field:
substitute(Type, "¶", "\") & "\"

Now perform a find on that calc field by always including the backslash
at the end (i.e. search for "Black Bear\" without the quotes).



Howard Schlossberg wrote:
Quote:
If it's a scripted find then then Kent's suggestion to use the return
character would work, but only if the entire search term is enclosed in
quotes and only if every line has a return at the end (i.e. an extra
blank line at the end). I say it needs to be scripted because it is
quite difficult to get the return character in there during a manual Find.

Another option if you only need to find on this one field and it can be
scripted: Let the user enter the term into a global field and then click
a 'go' button. That Go button would perform a Go To Related Records
step. This will work because the index used in a relationship treats
each line of the match field as a separate match key.

At the moment, I'm not having any other brainstorms...but then I haven't
yet had my first cup of coffee for the day.

dpmoyd wrote:

I hadn't thought of that, but unfortunately, that didn't work, either.
Thanks for the suggestion.


I don't expect it will work, but could you try try searching for your
string with the "¶" paragraph symbol at the end?

Thus "Brown Bear¶" maybe? I haven't actually tried that.




--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg (818) 883-2846
FM Pro Solutions Los Angeles, California

FileMaker 7 Certified Developer
Associate Member, FileMaker Solutions Alliance


Reply With Quote
  #13  
Old   
Howard Schlossberg
 
Posts: n/a

Default Re: Any way to search for exact phrase within other text? - 04-29-2005 , 03:51 PM



Howard Schlossberg wrote:
Quote:
This time, I've had both coffee and lunch.

Create a stored/indexed calc field:
substitute(Type, "¶", "\") & "\"

Now perform a find on that calc field by always including the backslash
at the end (i.e. search for "Black Bear\" without the quotes).
Of course, this would also find 'Black-Spotted Bear\'. So you might
want to put the double-quotes around your search term afterall.


Quote:

Howard Schlossberg wrote:

If it's a scripted find then then Kent's suggestion to use the return
character would work, but only if the entire search term is enclosed
in quotes and only if every line has a return at the end (i.e. an
extra blank line at the end). I say it needs to be scripted because
it is quite difficult to get the return character in there during a
manual Find.

Another option if you only need to find on this one field and it can
be scripted: Let the user enter the term into a global field and then
click a 'go' button. That Go button would perform a Go To Related
Records step. This will work because the index used in a relationship
treats each line of the match field as a separate match key.

At the moment, I'm not having any other brainstorms...but then I
haven't yet had my first cup of coffee for the day.

dpmoyd wrote:

I hadn't thought of that, but unfortunately, that didn't work, either.
Thanks for the suggestion.



I don't expect it will work, but could you try try searching for your
string with the "¶" paragraph symbol at the end?

Thus "Brown Bear¶" maybe? I haven't actually tried that.






--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg (818) 883-2846
FM Pro Solutions Los Angeles, California

FileMaker 7 Certified Developer
Associate Member, FileMaker Solutions Alliance


Reply With Quote
  #14  
Old   
DPM
 
Posts: n/a

Default Re: Any way to search for exact phrase within other text? - 05-02-2005 , 03:57 PM



Thanks to everyone for your replies. I got it to work, finally! I
wanted to keep everything transparent to the user, so what I did was
script it such that if there was only one checkbox value (i.e. no
carriage returns), it would do a simple show related records call. If
there was more than one checkbox value, I used text parsing, a loop and
counter, and Howard's substitution suggestion (though I also added
something to the front of the text in the calc field - of course, I
have one value where there is an additional word at the *front*) to
perform finds, with each find constraining the results further so I get
an "and" find for all the values.

Thanks again for all your help!
DPM


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.