Adam and Jeff Excellent! I learned something today.... Thanks
-----Original Message----- From: Adam Wayne Lehman [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 07, 2003 10:08 AM To: [EMAIL PROTECTED] Subject: RE: [CFCDev] Using Structs I might be missing your question but simple loop should do the trick for accessing the data and populating your select box. If you are talking about dynamically creating the array from a query you can just use arrayAppend() like so: <cfscript> state = arrayNew(1); for(i = 1; i LTE stateQuery.recordCount; i = i + 1) { temp = structNew(); temp.name = stateQuery.name[i]; temp.abbv = stateQuery.abbv[i]; arrayAppend(state, temp); } return state; </cfscript> Adam Wayne Lehman Web Systems Developer Johns Hopkins Bloomberg School of Public Health Distance Education Division -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ung, Seng Sent: Monday, October 06, 2003 6:04 PM To: [EMAIL PROTECTED] Subject: RE: [CFCDev] Using Structs Adam: Then, how would you advanced to the next state by using single Dim Array? <cfscript> state = arrayNew(1); state[1] = structNew(); state[1].name = "Alabama"; state[1].abbv = "AL"; ... state[?].name = "Washington"; state[?].abbv = "WA"; return state; </cfscript> -----Original Message----- From: Adam Wayne Lehman [mailto:[EMAIL PROTECTED] Sent: Monday, October 06, 2003 10:49 AM To: [EMAIL PROTECTED] Subject: RE: [CFCDev] Using Structs Any drawback to doing it this way? <cfscript> state = arrayNew(1); state[1] = structNew(); state[1].name = "Alabama"; state[1].abbv = "AL"; ... return state; </cfscript> I think it's just easier to read and loop over state[index].name or state[index].abbv. So the question is... which has a faster execute? Adam Wayne Lehman Web Systems Developer Johns Hopkins Bloomberg School of Public Health Distance Education Division -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Wayne Graham Sent: Monday, October 06, 2003 1:20 PM To: [EMAIL PROTECTED] Subject: [CFCDev] Using Structs -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm having a minor problem thinking this afternoon. I have a CFC that returns state abbreviations and state names as a structure. For the life of me, I can't remember how to loop over the structure to input it into a select box. Here's a sample of the cfc: <cfscript> a = structNew(); a.state = ArrayNew(2); a.state[1][1] = "AL"; a.state[1][2] = "Alabama"; ... return a; </cfscript> I just can't seem to loop over the structure properly using <cfloop>... Am I using the structure properly? Should this just be an array passed back? Are there conventions for this? The final output I'm looking for is: <select name="state"> <option value="AL">Alabama I just keep getting various java errors. Can someone help? Thanks, Wayne ************************************** Wayne Graham Systems Office Earl Gregg Swem Library College of William and Mary PO Box 8794 Williamsburg, VA 23187-8794 757.221.3112 -----BEGIN PGP SIGNATURE----- Version: PGPfreeware 6.5.8 for non-commercial use <http://www.pgp.com> iQA/AwUBP4GkI1uRxBfF5S5XEQL5KACg0ai+NLynloTFcEMtNu7ak5T+kOEAniLf PFTAULfYIziYpaIXO+FrL6xs =sG/k -----END PGP SIGNATURE----- ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
