This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01BFF262.E60F6A70
Content-Type: text/plain;
        charset="iso-8859-1"

DO this


<cfquery name="GetTable1Thing" datasource=#application.datasource#>
        SELECT name, loc_id FROM Table1 WHERE <!--- whatever --->
</cfquery>
<!--- Query lookup table --->
<cfquery name="GetLocations" datasource=#application.datasource#>
        SELECT loc_id, loc_desc FROM Table2 ORDER BY loc_desc
</cfquery>

To create a select list of locations and dynamically change the selected
item from the list :

Replace variables.loc_id with whatever variable you are testing against:
        <select name="locations">
        <CFOUTPUT QUERY="getlocations">
                <OPTION VALUE="#getlocations.loc_id#"
                                #IIF(variables.loc_id EQ
getlocations.loc_id, DE('SELECTED'), DE(''))#>#loc_desc#
                </OPTION>
        </CFOUTPUT>

Beth Strichartz

-----Original Message-----
From: DeVoil, Nick [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 20, 2000 11:33 AM
To: '[EMAIL PROTECTED]'
Cc: 'Ray, James A'
Subject: RE: Queries and subQueries






> I want to populate a "select box" so I can select the correct location.

Not sure if anyone has answered this one already, I don't seem to be
receiving all the posts today.
Is this what you're after?

<!--- Main query driving form --->
<cfquery name="GetTable1Thing" datasource=#application.datasource#>
        SELECT name, loc_id FROM Table1 WHERE <!--- whatever --->
</cfquery>

<!--- Query lookup table --->
<cfquery name="GetLocations" datasource=#application.datasource#>
        SELECT loc_id, loc_desc FROM Table2 ORDER BY loc_desc
</cfquery>

<!--- form to update or insert Table1 thing --->
<cfform action="whatever.cfm" method="post">

<cfif #MODE# is "UPDATE"> <!--- or however else you control this --->
                Location
                <select name="location"><cfoutput query="GetLocations">
                <cfif #GetTable1Thing.loc_id# is #GetLocations.loc_id#>

                        <--- make the right location be automatically
selected when in update mode --->
                        <option value="#GetLocations.loc_id#"
selected>#GetLocations.loc_desc#
                <cfelse>
                        <option
value="#GetLocations.loc_id#">#GetLocations.loc_desc#
                </cfif></cfoutput></select>
<cfelse> <!--- mode is insert --->
                Location
                <select name="location"><cfoutput query="GetLocations">
                        <option
value="#GetLocations.loc_id#">#GetLocations.loc_desc#</cfoutput></select>

</cfif>

</cfform>


Nick


**********************************************************************
Information in this email is confidential and may be privileged.
It is intended for the addressee only. If you have received it in error,
please notify the sender immediately and delete it from your system. 
You should not otherwise copy it, retransmit it or use or disclose its
contents to anyone. 
Thank you for your co-operation.
**********************************************************************
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

------_=_NextPart_001_01BFF262.E60F6A70
Content-Type: text/html;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2652.35">
<TITLE>RE: Queries and subQueries</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>DO this</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>&lt;cfquery name=3D&quot;GetTable1Thing&quot; =
datasource=3D#application.datasource#&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>SELECT =
name, loc_id FROM Table1 WHERE &lt;!--- whatever ---&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;/cfquery&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;!--- Query lookup table ---&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;cfquery name=3D&quot;GetLocations&quot; =
datasource=3D#application.datasource#&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>SELECT =
loc_id, loc_desc FROM Table2 ORDER BY loc_desc</FONT>
<BR><FONT SIZE=3D2>&lt;/cfquery&gt;</FONT>
</P>

<P><FONT SIZE=3D2>To create a select list of locations and dynamically =
change the selected item from the list :</FONT>
</P>

<P><FONT SIZE=3D2>Replace variables.loc_id with whatever variable you =
are testing against:</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;select name=3D&quot;locations&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;CFOUTPUT QUERY=3D&quot;getlocations&quot;&gt;</FONT>
<BR><FONT SIZE=3D2>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;OPTION =
VALUE=3D&quot;#getlocations.loc_id#&quot;</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #IIF(variables.loc_id EQ =
getlocations.loc_id, DE('SELECTED'), DE(''))#&gt;#loc_desc#</FONT>
<BR><FONT SIZE=3D2>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/OPTION&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;/CFOUTPUT&gt;</FONT>
</P>

<P><FONT SIZE=3D2>Beth Strichartz</FONT>
</P>

<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: DeVoil, Nick [<A =
HREF=3D"mailto:[EMAIL PROTECTED]">mailto:[EMAIL PROTECTED]</A>]<=
/FONT>
<BR><FONT SIZE=3D2>Sent: Thursday, July 20, 2000 11:33 AM</FONT>
<BR><FONT SIZE=3D2>To: '[EMAIL PROTECTED]'</FONT>
<BR><FONT SIZE=3D2>Cc: 'Ray, James A'</FONT>
<BR><FONT SIZE=3D2>Subject: RE: Queries and subQueries</FONT>
</P>
<BR>
<BR>
<BR>
<BR>
<BR>

<P><FONT SIZE=3D2>&gt; I want to populate a &quot;select box&quot; so I =
can select the correct location.</FONT>
</P>

<P><FONT SIZE=3D2>Not sure if anyone has answered this one already, I =
don't seem to be</FONT>
<BR><FONT SIZE=3D2>receiving all the posts today.</FONT>
<BR><FONT SIZE=3D2>Is this what you're after?</FONT>
</P>

<P><FONT SIZE=3D2>&lt;!--- Main query driving form ---&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;cfquery name=3D&quot;GetTable1Thing&quot; =
datasource=3D#application.datasource#&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>SELECT =
name, loc_id FROM Table1 WHERE &lt;!--- whatever ---&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;/cfquery&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;!--- Query lookup table ---&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;cfquery name=3D&quot;GetLocations&quot; =
datasource=3D#application.datasource#&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>SELECT =
loc_id, loc_desc FROM Table2 ORDER BY loc_desc</FONT>
<BR><FONT SIZE=3D2>&lt;/cfquery&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;!--- form to update or insert Table1 thing =
---&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;cfform action=3D&quot;whatever.cfm&quot; =
method=3D&quot;post&quot;&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;cfif #MODE# is &quot;UPDATE&quot;&gt; &lt;!--- or =
however else you control this ---&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>Location</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&lt;select =
name=3D&quot;location&quot;&gt;&lt;cfoutput =
query=3D&quot;GetLocations&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&lt;cfif =
#GetTable1Thing.loc_id# is #GetLocations.loc_id#&gt;</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&lt;--- make =
the right location be automatically</FONT>
<BR><FONT SIZE=3D2>selected when in update mode ---&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&lt;option =
value=3D&quot;#GetLocations.loc_id#&quot;</FONT>
<BR><FONT SIZE=3D2>selected&gt;#GetLocations.loc_desc#</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;cfelse&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;option</FONT>
<BR><FONT =
SIZE=3D2>value=3D&quot;#GetLocations.loc_id#&quot;&gt;#GetLocations.loc_=
desc#</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;/cfif&gt;&lt;/cfoutput&gt;&lt;/select&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;cfelse&gt; &lt;!--- mode is insert =
---&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>Location</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&lt;select =
name=3D&quot;location&quot;&gt;&lt;cfoutput =
query=3D&quot;GetLocations&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;option</FONT>
<BR><FONT =
SIZE=3D2>value=3D&quot;#GetLocations.loc_id#&quot;&gt;#GetLocations.loc_=
desc#&lt;/cfoutput&gt;&lt;/select&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;/cfif&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;/cfform&gt;</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>Nick</FONT>
</P>
<BR>

<P><FONT =
SIZE=3D2>***************************************************************=
*******</FONT>
<BR><FONT SIZE=3D2>Information in this email is confidential and may be =
privileged.</FONT>
<BR><FONT SIZE=3D2>It is intended for the addressee only. If you have =
received it in error,</FONT>
<BR><FONT SIZE=3D2>please notify the sender immediately and delete it =
from your system. </FONT>
<BR><FONT SIZE=3D2>You should not otherwise copy it, retransmit it or =
use or disclose its</FONT>
<BR><FONT SIZE=3D2>contents to anyone. </FONT>
<BR><FONT SIZE=3D2>Thank you for your co-operation.</FONT>
<BR><FONT =
SIZE=3D2>***************************************************************=
*******</FONT>
<BR><FONT =
SIZE=3D2>---------------------------------------------------------------=
---------------</FONT>
<BR><FONT SIZE=3D2>Archives: <A =
HREF=3D"http://www.mail-archive.com/cf-talk@houseoffusion.com/" =
TARGET=3D"_blank">http://www.mail-archive.com/cf-talk@houseoffusion.com/=
</A></FONT>
<BR><FONT SIZE=3D2>To Unsubscribe visit <A =
HREF=3D"http://www.houseoffusion.com/index.cfm?sidebar=3Dlists&body=3Dli=
sts/cf_talk" =
TARGET=3D"_blank">http://www.houseoffusion.com/index.cfm?sidebar=3Dlists=
&body=3Dlists/cf_talk</A> or send a message to =
[EMAIL PROTECTED] with 'unsubscribe' in the =
body.</FONT></P>

</BODY>
</HTML>
------_=_NextPart_001_01BFF262.E60F6A70--
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to