filter expression for search string
whats a good filter expression for one up to 3 keywords.
if one keyword, it will be
NAME = '*keyword1*'
if 2 keyword, it will be
NAME = '*keyword1*' OR NAME = '*keyword2*'
if 3 keyword, it will be
NAME = '*keyword1*' OR NAME = '*keyword2*' OR NAME = '*keyword3*'
problem is how do i know if its 1 or 2 or 3 keyword entered in a search string
Re: filter expression for search string
Re: filter expression for search string
This is definately not an expert answer hehe. But this may help get you on track.
Code:
Private Function GetFilterString(ByVal SearchString as String) As String
Dim strSearchWords as String()
Dim Filter as String
strSearchWords = SearchString.Split(New [Char]() {" "})
For i as Integer = 0 to strSearchWords.Length() - 1
If Filter <> "" Then
Filter &= " OR "
End If
Filter &= "NAME = '*" & strSearchWords(i) & "*'"
Next
Return Filter
End Function
Re: filter expression for search string
If you are specifically looking for the number, then just return the .length in the code that I posted.