listgetat(list1, mselect1) does what you asked about. Just out of curiosity, why are you converting this to a list manually? Or at all?
Why not: <cfquery...></cfquery> <cfoutput> #qlistdata.id[randrange(1, arraylen(qlistdata.id))]# </cfoutput> -- Ben Doom Programmer & General Lackey Moonbow Software, Inc : -----Original Message----- : From: Tony Gruen [mailto:[EMAIL PROTECTED] : Sent: Friday, June 20, 2003 2:19 PM : To: CF-Talk : Subject: Almost there - stuck : : : This s probably right under my nose but I can't see it... Here is the : situation: I need a single item selected/displayed from a list - picked : randomly so a single different selection (potentially) from the list shows : each visit. : : -I run a query to get select records meeting some criteria. : <cfquery name="qListData" datasource="MyDB"> : SELECT ID : FROM tblItems : WHERE foo = 1 : </cfquery> : : -Create a list of the IDs : <CFOUTPUT Query="qListData"> : <CFSET List1 = #ListAppend(List1, ID, ",")#> : </cfoutput> : : -Order the list and pick one at random : <CFLOOP From = "1" To = "#ListLen(List1)#" INDEX = "Counter"></CFLOOP> : <CFSET Max1 = #ListLen(List1)#> : <CFSET Mselect1 = #RandRange(1, Max1)#> : : ******Here is where I am stuck..... : How to I associate the variable Mselect1 (the counter) to the : corresponding : ID so I can display data? : : Thank you for taking the time to read this- any input on my method : (good-bad) is greatly appreciated. : : Tony Gruen : : : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4