Ricq,
The other response you got pretty well sums up the problem you've got -
you're only the value in your output loop to a single value from the user's
delivery locations. The way I see it you've got two choices:
1> Use a ListFind(get_del_locn.dlo_id,
ValueList(get_user_del_locn.dlo_id)) instead of your current CFIF
criteria. That should compare the dlo_id to a list of all the IDs returned
by the user location query.
2> Use an Outer Join query to combine your two queries. If you construct
the query so that you get all of the IDs and Locn names and then an
additional ID (aliased to a different name) if the record in question is
also located in the User_del table. In your cfoutput loop, you can do a
cfif and test the Len() of the additional ID or determine whether its null,
something like that. This can work really slick but whether you can use it
will depend on what database you are using, etc. If you aren't familiar
with Outer Joins, check out Forta's Web Application Construction Kit book -
its got good examples of some simple outer joins.
hope this helps,
Kevin
ps: How's the Cow Campus today?!
At 08:33 AM 4/11/00 -0500, you wrote:
>I'm using a CF template that attempts to pre-select several items in a list
>box based on values returned from 2 queries. If a match occurs, that entry
>in the list box should be selected. There will almost always be more than
>one match. Specifically, the list box should list all possible delivery
>locations (from the get_del_locn query) and highlight/pre-select those
>locations that a user has a record returned for in get_usr_del_locn. What
>the code below produces *almost* works - all possible delivery locations are
>in the list box, but only *one* of the user's specific locations is selected
>even though they might have 4 or 5 locations tied to their usr_id.
>
>So... Why doesn't this code work?
>
><!--- get a user's specific delivery locations --->
> <cfquery datasource="centsup_dev" name="get_user_del_locn" debug="yes">
> select user_del.dlo_id
> from del_locn, user_del
> where del_locn.dlo_id = user_del.dlo_id
> and user_del.usr_id = #usr_id#
> </cfquery>
>
><!--- get all possible delivery locations --->
> <cfquery datasource="centsup_dev" name="get_del_locn" debug="yes">
> select dlo_id, dlo_locn
> from del_locn
> order by dlo_locn
> </cfquery>
>
><!--- create the list box; attempt to pre-select user's location(s) --->
> <select name="dlo_id" size =5 width=150 multiple>
> <cfoutput query="get_del_locn">
> <cfif #get_user_del_locn.dlo_id# is #get_del_locn.dlo_id#>
> <option value=#get_del_locn.dlo_id# selected>#get_del_locn.dlo_locn#
> <cfelse>
> <option value=#get_del_locn.dlo_id#>#get_del_locn.dlo_locn#
> </cfif>
> </cfoutput>
> </select>
>
>
>~~~~~~~~~~~~~~~~~~~~~~~~
>Ricq Pattay <[EMAIL PROTECTED]>
>Univ of MN College of Veterinary Medicine
>
>
>
>
>------------------------------------------------------------------------------
>Archives: http://www.eGroups.com/list/cf-talk
>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.
--------------------------
Kevin Marshall
Web Application Developer
eCalton.com, Inc.
Vero Beach, FL
www.ecalton.com
[EMAIL PROTECTED]
561.569.4500
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
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.