Yes - looks like a plain ol' IN clause to me too. Makes sure and account for
you datatype.

Mark

-----Original Message-----
From: LANCASTER, STEVEN M. (JSC-OL) (BAR)
[mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 12, 2002 4:21 PM
To: CF-Talk
Subject: RE: SQL in a CFIF


#org_dlo# can equal on of three numbers at this point. When they update the
database the ID's change so this time it may be 18, 20, 21 next week it may
be 1, 2, 3 and so on and so forth. I need to create everything so that if
the ID's change the application will function exactly the same way without
any interruption.

            <CFIF IsDefined("dlo_org")>
                   <CFIF Len(dlo_org) GT 0>
                 <TD VALIGN="top" ALIGN="left">
                              <FONT SIZE="-1">
                                   <cfoutput>
                                <cfquery name="getDloOrganization"
datasource="#application.lldbDatasource#">
                                SELECT  DISTINCT
InitCap(ll_userroles.userroles) || ' - ' || ll_organization.description as
description
                                FROM    ll_userroles,
                                                ll_useruserroles,
                                                ll_user_org,
                                                ll_organization
                                WHERE   ll_userroles.userroles_id =
'#org_dlo#'
                                        AND
ll_userroles.userroles_id = ll_useruserroles.userroles_id
                                        AND
ll_useruserroles.useruserroles_id = ll_user_org.useruserroles_id
                                        AND     ll_user_org.org_id =
ll_organization.org_id
                        </cfquery>
                        </cfoutput>
                                                        <cfoutput
query="getDloOrganization">

#description#
                                                        </cfoutput>
                <CFELSE>
                                        &nbsp;
                   </CFIF>
                </FONT>
                        </TD>
            </CFIF>

Steven Lancaster
Barrios Technology
NASA/JSC
281-244-2444 (voice)
[EMAIL PROTECTED]

-----Original Message-----
From: Mark A. Kruger - CFG [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 12, 2002 4:14 PM
To: CF-Talk
Subject: RE: SQL in a CFIF


Ok ... I have no idea what that means.  Perhaps you should post some actual
code.

Mark

-----Original Message-----
From: LANCASTER, STEVEN M. (JSC-OL) (BAR)
[mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 12, 2002 4:07 PM
To: CF-Talk
Subject: RE: SQL in a CFIF


Yeah but the 1 or 2 or 3 is dynamic and may not always be the same. If I
have the ability to run a query I can figure out which one I need.

Steven Lancaster
Barrios Technology
NASA/JSC
281-244-2444 (voice)
[EMAIL PROTECTED]

-----Original Message-----
From: Mark A. Kruger - CFG [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 12, 2002 4:08 PM
To: CF-Talk
Subject: RE: SQL in a CFIF


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

Reply via email to