I ended up writing a function to strip the newlines

<cffunction name="StripNL" returnType="string">
        <cfargument name="string" type="string">
        <cfreturn replace(string, "#chr(10)#", "", "all")>
</cffunction>


That did the trick.

thanks,

Luis

-----Original Message-----
From: John Paul Ashenfelter [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 08, 2003 4:20 PM
To: CF-Talk
Subject: Re: Building and saving a query string


Lots of options:

1) StripCR() CF function
2) Regex for stripping extra CR/LF/spaces
3) database functions for text processing
4) search/replace in either cf or db.

I'd try StripCR as a start.

Regards,

John Paul Ashenfelter
CTO/Transitionpoint
[EMAIL PROTECTED]
----- Original Message -----
From: "Luis Lebron" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, January 08, 2003 4:49 PM
Subject: Building and saving a query string


> I'm using the following code to build and display a query string:\
> <cfsavecontent variable="myquery">
> Select * from contacts where 1
> <cfif Form.company IS NOT "All">and company like
> '%<cfoutput>#Form.company#</cfoutput>%'</cfif>
> <cfif Form.title IS NOT "All">and title like
> '%<cfoutput>#Form.title#</cfoutput>%'</cfif>
> <cfif Form.city IS NOT "All">and city like
> '%<cfoutput>#Form.city#</cfoutput>%'</cfif>
> <cfif Form.state IS NOT "All">and state like
> '%<cfoutput>#Form.state#</cfoutput>%'</cfif>
> <cfif Form.country IS NOT "All">and country like
> '%<cfoutput>#Form.country#</cfoutput>%'</cfif>
> <cfif Form.type IS NOT "All">and type_of_industry like
> '%<cfoutput>#Form.type#</cfoutput>%'</cfif>
> <cfif Form.size IS NOT "All">and company_size
> <cfoutput>#Form.size#</cfoutput></cfif>
> <cfif Form.department IS NOT "All">and department like
> '%<cfoutput>#Form.department#</cfoutput>%'</cfif>
> <cfif Form.source IS NOT "All">and source_of_contact like
> '%<cfoutput>#Form.source#</cfoutput>%'</cfif>
> </cfsavecontent>
>
> <cfoutput>#(myquery)#
> </cfoutput>
>
> The query string builds and displays correctly.
> For example:
> Select * from contacts where 1 and company like '%Company 1%' and title
like
> '%Title 1%' and type_of_industry like '%Manufacturing%' and company_size
> <250 and department like '%Training%"
>
> However, when I try to save the query string in the database later it has
a
> lot of unneeded spaces and line breaks like so:
>
> Select * from contacts where 1
> and company like '%Company 1%'
> and title like '%Title 1%'
>
>
>
> and type_of_industry like '%Manufacturing%'
> and company_size <250
> and department like '%Training%'
>
> Is there any way I can fix this?
>
>
> thanks,
>
>
> Luis
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to