![]() | |
![]() |
| | Thread Tools | Display Modes |
#11
| |||
| |||
|
|
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 |
#12
| |||
| |||
|
|
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. |
#13
| |||
| |||
|
|
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: 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. |
#14
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |