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><cfquery name=3D"GetTable1Thing" =
datasource=3D#application.datasource#></FONT>
<BR> <FONT SIZE=3D2>SELECT =
name, loc_id FROM Table1 WHERE <!--- whatever ---></FONT>
<BR><FONT SIZE=3D2></cfquery></FONT>
<BR><FONT SIZE=3D2><!--- Query lookup table ---></FONT>
<BR><FONT SIZE=3D2><cfquery name=3D"GetLocations" =
datasource=3D#application.datasource#></FONT>
<BR> <FONT SIZE=3D2>SELECT =
loc_id, loc_desc FROM Table2 ORDER BY loc_desc</FONT>
<BR><FONT SIZE=3D2></cfquery></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> <FONT =
SIZE=3D2><select name=3D"locations"></FONT>
<BR> <FONT =
SIZE=3D2><CFOUTPUT QUERY=3D"getlocations"></FONT>
<BR><FONT SIZE=3D2> =
<OPTION =
VALUE=3D"#getlocations.loc_id#"</FONT>
<BR><FONT =
SIZE=3D2> =
=
=
#IIF(variables.loc_id EQ =
getlocations.loc_id, DE('SELECTED'), DE(''))#>#loc_desc#</FONT>
<BR><FONT SIZE=3D2> =
</OPTION></FONT>
<BR> <FONT =
SIZE=3D2></CFOUTPUT></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>> I want to populate a "select box" 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><!--- Main query driving form ---></FONT>
<BR><FONT SIZE=3D2><cfquery name=3D"GetTable1Thing" =
datasource=3D#application.datasource#></FONT>
<BR> <FONT SIZE=3D2>SELECT =
name, loc_id FROM Table1 WHERE <!--- whatever ---></FONT>
<BR><FONT SIZE=3D2></cfquery></FONT>
</P>
<P><FONT SIZE=3D2><!--- Query lookup table ---></FONT>
<BR><FONT SIZE=3D2><cfquery name=3D"GetLocations" =
datasource=3D#application.datasource#></FONT>
<BR> <FONT SIZE=3D2>SELECT =
loc_id, loc_desc FROM Table2 ORDER BY loc_desc</FONT>
<BR><FONT SIZE=3D2></cfquery></FONT>
</P>
<P><FONT SIZE=3D2><!--- form to update or insert Table1 thing =
---></FONT>
<BR><FONT SIZE=3D2><cfform action=3D"whatever.cfm" =
method=3D"post"></FONT>
</P>
<P><FONT SIZE=3D2><cfif #MODE# is "UPDATE"> <!--- or =
however else you control this ---></FONT>
<BR> =
<FONT =
SIZE=3D2>Location</FONT>
<BR> =
<FONT SIZE=3D2><select =
name=3D"location"><cfoutput =
query=3D"GetLocations"></FONT>
<BR> =
<FONT SIZE=3D2><cfif =
#GetTable1Thing.loc_id# is #GetLocations.loc_id#></FONT>
</P>
<P> =
=
<FONT SIZE=3D2><--- make =
the right location be automatically</FONT>
<BR><FONT SIZE=3D2>selected when in update mode ---></FONT>
<BR> =
=
<FONT SIZE=3D2><option =
value=3D"#GetLocations.loc_id#"</FONT>
<BR><FONT SIZE=3D2>selected>#GetLocations.loc_desc#</FONT>
<BR> =
<FONT =
SIZE=3D2><cfelse></FONT>
<BR> =
=
<FONT =
SIZE=3D2><option</FONT>
<BR><FONT =
SIZE=3D2>value=3D"#GetLocations.loc_id#">#GetLocations.loc_=
desc#</FONT>
<BR> =
<FONT =
SIZE=3D2></cfif></cfoutput></select></FONT>
<BR><FONT SIZE=3D2><cfelse> <!--- mode is insert =
---></FONT>
<BR> =
<FONT =
SIZE=3D2>Location</FONT>
<BR> =
<FONT SIZE=3D2><select =
name=3D"location"><cfoutput =
query=3D"GetLocations"></FONT>
<BR> =
=
<FONT =
SIZE=3D2><option</FONT>
<BR><FONT =
SIZE=3D2>value=3D"#GetLocations.loc_id#">#GetLocations.loc_=
desc#</cfoutput></select></FONT>
</P>
<P><FONT SIZE=3D2></cfif></FONT>
</P>
<P><FONT SIZE=3D2></cfform></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.