Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Parameter String Text Search

Status
Not open for further replies.

JohnAtCCC

IS-IT--Management
May 21, 2003
2
US
My database table has a 250 character free text field named "MEMO". I present the user with a parameter field named "Keyword". Keyword is a multiple value parameter field.

I want to search the MEMO field for each discrete parameter string entered by the user. This is basically a keyword search using multiple keywords. Since the user may enter multiple parameter strings, how do i parse out each distinct parameter string value and then create a query based on each distinct string?


 
First, don't make it a multiple value paramter, just make the users key in a comma between each search entry, then create a formula :

@Search
StringVar Search := Replace ({?searchparameter},',','*", "*');
Search := '"*'&Search&'*"';

Then in the Record selection formula put:
{Memofield} like [{@Search}]

replace italics with correct field names.

This might work, but i've not tested it.

Reebo
Scotland (Sunny with a Smile)
 
Do you want to return fields that match *any* of the keywords.. or all of the keywords...

Lisa
 
A multiple value parm is fine, and it's easier.

Try:

if {Customer.Customer Name} in {?multinames} then
"yaaay"
else
"nay"

That tells you if any of them hit.

You can parse out the multi by referencing it like this:

{?multinames}[1]

So you might use a loop and iterate the subscript, but why bother if the above works.

If the requirements differ, please specify how.

-k
 
Sorry, I misread your post, use:

Reebos solution looks good.

Or this is how you'd check each element:

whileprintingrecords;
numbervar counter;
booleanvar GotAHit;
For counter := 1 to ubound({?multinames}) do(
if instr({Customer.Customer Name},{?multinames}[counter]) > 0 then
GotAHit := True
);
GotAHit

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top