RE: RE: Using CFmail and loops
The reason I suggested the replace is in case his form.propertytype is a list of strings (eg "rental,studio,ranch,condo")... that would blow up an in-based where clause (the result would be WHERE PropertyType IN (rental,studio,ranch,condo) unless you use the replace, in which case it comes out as WHERE PropertyType IN ('rental','studio','ranch','condo')) .. that and the fact that ListQualify doesn't come up in my version of CF ;) C. Hatton Humphrey, Developer Fisher, Towne & Associates 716-839-2141 x336 [EMAIL PROTECTED] > -Original Message- > From: Billy Cravens [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 25, 2002 12:40 PM > To: CF-Talk > Subject: Re: RE: Using CFmail and loops > > > Actually, it might be a bit cleaner to use the ListQualify > function instead > of Replace: > > listQualify(form.propertyType,"'") > > - Original Message - > From: "C. Hatton Humphrey" <[EMAIL PROTECTED]> > To: "CF-Talk" <[EMAIL PROTECTED]> > Sent: Friday, January 25, 2002 11:15 AM > Subject: RE: RE: Using CFmail and loops > > > > Stephen, > > > > You should be able to re-work your query to use the in function (where > > PropertyType IN ('#replace(form.propertytype, ",", "','", "ALL")#'). > > > > Also, you might try building a pseudo grouping into your loop inside the > > cfmail and take out the query parameter of the cfmail tag assuming > that > > you only want one email generated per serarch, right? > > > > Hatton > > > > > > > > > > > > > > > > > > > > SELECT PropertyID, > > > FullJobName, > > > PropertyType, > > > Tenure > > > FROM Properties > > > WHERE PropertyType = '#FORM.PropertyType#' > > > > > > > > > > > > > > "Freehold,Leasehold"> > > > > > > AND Tenure = > > > '#FORM.PropertyInfo#' > > > > > > > > > > > > > > > > > > AND OnPrintedList = 1 > > > ORDER BY PropertyType, > > > FullJobName, > > > Tenure > > > > > > > > > > > > > > > > > > > > to="[EMAIL PROTECTED]" > > > from="[EMAIL PROTECTED]" > > > server="mail.company.com" > > > port=25 > > > timeout=20 > > > type="HTML"> > > > > > > > > > > > > > > > > > > > > > > > > #SearchProperties.FullJobName# > > > > > > #SearchProperties.PropertyType# > > > > > > #SearchProperties.Tenure# > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Hope this helps, > > > > > > Cheers Stephen > > > > > > > > > > > > > > > > > > __ Why Share? Dedicated Win 2000 Server · PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: RE: Using CFmail and loops
Actually, it might be a bit cleaner to use the ListQualify function instead of Replace: listQualify(form.propertyType,"'") - Original Message - From: "C. Hatton Humphrey" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Friday, January 25, 2002 11:15 AM Subject: RE: RE: Using CFmail and loops > Stephen, > > You should be able to re-work your query to use the in function (where > PropertyType IN ('#replace(form.propertytype, ",", "','", "ALL")#'). > > Also, you might try building a pseudo grouping into your loop inside the > cfmail and take out the query parameter of the cfmail tag assuming that > you only want one email generated per serarch, right? > > Hatton > > > > > > > > > > > > > SELECT PropertyID, > > FullJobName, > > PropertyType, > > Tenure > > FROM Properties > > WHERE PropertyType = '#FORM.PropertyType#' > > > > > > > > > "Freehold,Leasehold"> > > > > AND Tenure = > > '#FORM.PropertyInfo#' > > > > > > > > > > > > AND OnPrintedList = 1 > > ORDER BY PropertyType, > > FullJobName, > > Tenure > > > > > > > > > > > > > to="[EMAIL PROTECTED]" > > from="[EMAIL PROTECTED]" > > server="mail.company.com" > > port=25 > > timeout=20 > > type="HTML"> > > > > > > > > > > > > > > > > #SearchProperties.FullJobName# > > > > #SearchProperties.PropertyType# > > > > #SearchProperties.Tenure# > > > > > > > > > > > > > > > > > > > > > > > > > > Hope this helps, > > > > Cheers Stephen > > > > > > > > > > > __ Why Share? Dedicated Win 2000 Server · PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: RE: Using CFmail and loops
Stephen, You should be able to re-work your query to use the in function (where PropertyType IN ('#replace(form.propertytype, ",", "','", "ALL")#'). Also, you might try building a pseudo grouping into your loop inside the cfmail and take out the query parameter of the cfmail tag assuming that you only want one email generated per serarch, right? Hatton > > > > > > SELECT PropertyID, > FullJobName, > PropertyType, > Tenure > FROMProperties > WHERE PropertyType = '#FORM.PropertyType#' > > > >"Freehold,Leasehold"> > > AND Tenure = > '#FORM.PropertyInfo#' > > > > > > AND OnPrintedList = 1 > ORDER BYPropertyType, > FullJobName, > Tenure > > > > > > to="[EMAIL PROTECTED]" > from="[EMAIL PROTECTED]" > server="mail.company.com" > port=25 > timeout=20 > type="HTML"> > > > > > > > > #SearchProperties.FullJobName# > > #SearchProperties.PropertyType# > > #SearchProperties.Tenure# > > > > > > > > > > > > > Hope this helps, > > Cheers Stephen > > > > > __ Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: RE: Using CFmail and loops
Hi Hatton, Here is an example of my code: SELECT PropertyID, FullJobName, PropertyType, Tenure FROMProperties WHERE PropertyType = '#FORM.PropertyType#' AND Tenure = '#FORM.PropertyInfo#' AND OnPrintedList = 1 ORDER BYPropertyType, FullJobName, Tenure #SearchProperties.FullJobName# #SearchProperties.PropertyType# #SearchProperties.Tenure# Hope this helps, Cheers Stephen __ Why Share? Dedicated Win 2000 Server · PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Using CFmail and loops
Can you post a code snippet to show us an idea of what you're doing? Without seeing any, the suggestion might be to use CFParam to define your form checkboxes and in your SQL statement, use the IN (#form.fieldname#) as opposed to looping through a list. You'll need to make sure the formfield is defined, hence the referent to the cfparam. Also, if you've got a loop inside the cfmail tag, you'll probably need to drop the query parameter from the cfmail tag and do a query loop inside it. Hatton > -Original Message- > From: Stephen Adams [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 25, 2002 11:12 AM > To: CF-Talk > Subject: Using CFmail and loops > > > Hi, > > I am having a serious problem with CFMAIL. > > I have a form that has a collection of checkboxes, about nine of > them, the user can select any one of them or as many as they > want. This form also contain some other details that the user fills in. > > When they submit this form a search is carried out using the > criteria they have entered in the form, in order to get my query > to work I need to loop around the comma delimited list of values > sent by these checkboxes. Within each loop I have the search > query and the table in which the results are displayed. I have > to also loop around the results of this query in order for all of > them to be > displayed in the table and not just the last one. > > The problem I am having with cfmail is that I wish to send the > user these search results all within one email. > > Does anyone know how I can still have my outer loop and inner > loop, and send the result in one email. > > Thanks > > Stephen > __ Why Share? Dedicated Win 2000 Server · PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists