This topic is locked

Boolean Searching

6/3/2004 11:35:37 AM
ASPRunnerPro General questions
S
Scruffy author

Is it possible to do boolean searching of fields.
eg Field1 Contains X And Y

or Field1 Contains X or Y
etc
Cheers
Scruffy

Sergey Kornilov admin 6/8/2004

Scruffy,
this can be done manually.
You need to parse search string and build corresponding WHERE condition.

S
Scruffy author 6/16/2004

Thanks for the reply, i've done something similar to your Advanced Between Search criteria, i now have Contains (AND) and Contains (OR) options in which the user has the option of two boxes, ie (X And Y) or (X or Y) depending which option is chosen in the pull down down.

How can i now alter the function code below to show the last two options with SearchFor2 enabled, not just the last option in the list? Can i somehow put an OR statement in with [i].options.length - 2 == ?
I'll have a play in the meantime to see what happens!
TIA
Scruffy.
function ShowHideControls()

{

var i;

for (i=0;i<document.forms.frmAdmin.SearchFor2.length; ++i)

{

document.forms.frmAdmin.SearchFor2[i].className =

document.forms.frmAdmin.SearchOption[i].options.length - 1 ==

document.forms.frmAdmin.SearchOption[i].selectedIndex ? 'vis1' : 'vis2';

}

return false;

}

S
Scruffy author 6/16/2004

OK, i think i've managed to sort the above, but as i'm now using OR in my clause i'm getting some strange results, i guess i need to now enclose the sqlstring in brackets for it to return the right results.
At present it reads field1 like cat and like dog and field2 like house or like mouse, but needs to (field1 like cat and like dog) and (field2 like house or like mouse)
Where would be the best place to include the brackets so the sql works correctly?
Again i'll have a play about to see if i can't figure it....
Cheers
Scruffy

S
Scruffy author 6/17/2004

Sorted now as well, best place on the list page :-)