Use Listfind <Cfif Listfind(varName, 1)> do A
<cfelseif Listfind(varName, 2)> do B </cfif> Listfind will work without throwing an error - even if the VarName is an empty string. Mark -----Original Message----- From: LANCASTER, STEVEN M. (JSC-OL) (BAR) [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 12, 2002 3:54 PM To: CF-Talk Subject: RE: SQL in a CFIF Let me give an understanding of what I am doing. I have a variable that is passing one or up to three numbers. The numbers are passed like this: 1, 2, 3 or 1 or 1,2. My problem is I need to check to see if the the number is listed in the #variable#. so That I can go from there. My application works as long as my variable is only passing one number. If it passes 2 numbers my query doesn't like it. I have a query based on the variable 2 being in there. Any help would be appreciated. I am going crazy trying to figure it out. Steven Lancaster Barrios Technology NASA/JSC 281-244-2444 (voice) [EMAIL PROTECTED] -----Original Message----- From: Brendan Avery [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 12, 2002 3:43 PM To: CF-Talk Subject: RE: SQL in a CFIF you can not have your cfif conditional execute on the database-side; but you can put cfif and other cftags inside a cfquery tag-pair. for example if you had a page that had to display some item from your database, you could use a cfif to decide whether to pull an item by id or if no id is specified, pull the default item: <cfquery name="iteminfo" datasource="mydsn"> SELECT TOP 1 * FROM tbl_Merchandise WHERE <cfparam name="currentitem" default=""> <cfif currentitem IS NOT ""> id=#currentitem# <cfelse> default='y' </cfif> </cfquery> but it is important to note that the cftags, including the cfif are processed before the query itself is sent to the sql server, so all this happens within cf. > -----Original Message----- > From: LANCASTER, STEVEN M. (JSC-OL) (BAR) > [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, March 12, 2002 13:30 > To: CF-Talk > Subject: SQL in a CFIF > > > How would write a select statement within a CFIF statement. > > 1. Can it be done? > > 2. What is the Syntax? > > Steven Lancaster > Barrios Technology > NASA/JSC > 281-244-2444 (voice) > [EMAIL PROTECTED] > ______________________________________________________________________ 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