CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Parsing Search Text

Print topic Send  topic

Author Message
NewbieRob

Posts: 20
Posted: 09/06/2005, 1:09 PM

I have a CCS generated grid and search box that work but I need to be able to parse the text entered into the search keyword and look for occurences of each each word (using OR). Parsing at each space would be OK but am open to requiring user to use quotes, commas, etc. if needed. I've tried code from an old GoToCode article with some modification but keep getting a VBS error: "Wrong number of arguments or invalid property assignment: 'CCGetParam' ". Can anyone out there point me in the right direction?

I am using CCS 2.3.2, and ASP 3.0 with Templates.
View profile  Send private message
donb

Posts: 52
Posted: 09/06/2005, 5:49 PM

dim keywords, keyword, sep, where
' Probably want this in the Before Build Select of the Grid

where = ""
sep = ""

keywords = split(CCGetParam("Textbox1",""), " ") ' Split the Textbox containing ouse search parmeters, making an array of words

for each keyword in keywords
if keyword <> "" then
where = where & sep & "'" & keyword & "'"
sep = " OR "
end if
next

' DIsplay the where clause
print "where clause = " & where

' Eventcaller will be the Grid's datasource

Eventcaller.Where = where
_________________
http://www.gotodon.com/ccbth
View profile  Send private message
NewbieRob

Posts: 20
Posted: 09/07/2005, 10:07 AM

I put this in the BeforeBuildSelect() event for the grid:

dim keywords, keyword, sep, where, i

where = ""
sep = ""

keywords = split(CCGetParam("s_keyword",""), " ") ' Split the Textbox containing search parameters, making an array of words

'for each keyword in keywords
for i=0 to ubound(keywords) step 1
if keyword <> "" then
where = where & sep & "'" & keyword & "'"
sep = " OR "
end if
next

Eventcaller.Where = where

It doesn't give me any errors but it doesn't change the way the search button works either. I know I'm missing something. Got any more advice?
View profile  Send private message
DonB
Posted: 09/07/2005, 2:31 PM

Not sure why you changed the 'for' but you're not extracting the array
elements with what you have. You can reference keywords(i) or use my
version of the for loop that doesn't need the 'i' index.

put in

print where
response.end

after the 'next' statement to confirm you are constructing a where
specification, by displaying it on the screen where you can check it.

--
DonB

http://www.gotodon.com/ccbth


"NewbieRob" <NewbieRob@forum.codecharge> wrote in message
news:6431f1e62a6db2@news.codecharge.com...
> I put this in the BeforeBuildSelect() event for the grid:
>
> dim keywords, keyword, sep, where, i
>
> where = ""
> sep = ""
>
> keywords = split(CCGetParam("s_keyword",""), " ") ' Split the Textbox
> containing search parameters, making an array of words
>
> 'for each keyword in keywords
> for i=0 to ubound(keywords) step 1
> if keyword <> "" then
> where = where & sep & "'" & keyword & "'"
> sep = " OR "
> end if
> next
>
> Eventcaller.Where = where
>
> It doesn't give me any errors but it doesn't change the way the search
button
> works either. I know I'm missing something. Got any more advice?
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

NewbieRob

Posts: 20
Posted: 09/07/2005, 2:53 PM

I changed the "for" because when it comes to programming I'm basically an idiot :-). I will put it back the way you had it and try it again.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.