William,
Thankyou very much. Very good solution. Could you please tell me how to read
data from this array?
Regards,
Ajoy
More detailed approach for a one-dimensional array using your example...
<!--- DECLARE THE LOCAL VARIABLES THAT WILL DEFINE THE STRUCTURE --->
<CFPARAM NAME="strEmpData_ssn_local" default="">
<CFPARAM NAME="strEmpData_firstname_local" default="">
<CFPARAM NAME="strEmpData_lastname_local" default="">
<!--- DECLARE THE ARRAY --->
<CFSET arrayofEmpData=ArrayNew(1)>
<!--- PERFORM QUERY --->
<cfquery name="getEmployee" datasource="test" dbtype="ODBC">
select ssn, firstName, lastName
from employee
</cfquery>
</CFTRY>
<!--- CREATE THE STRUCTURES AND THEN DUMP THEM INTO THE ARRAY --->
<CFLOOP QUERY="getEmployee">
<CFSCRIPT>
structEmpData=StructNew();
StructInsert(structEmpData, "strExtCriteriaID_local", "#getEmployee.ssn#");
StructInsert(structEmpData, "strEmpData_firstname_local",
"#getEmployee.firstName#");
StructInsert(structEmpData, "strEmpData_lastname_local",
"#getEmployee.lastName#");
#ArrayAppend(arrayofEmpData, structEmpData)#;
</CFSCRIPT>
</cfloop>
<!--- CHANGE THE ARRAY "scope" --->
<CFSET "scope".arrayofEmpData="#arrayofEmpData#">
--
William Adamsen
Senior Consultant
Syntegra (USA), Inc.
Direct: 415-934-6748
Mobile: 415-613-6590
-----Original Message-----
From: Ajoy Singh [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 12, 2000 9:53 AM
To: cf-Talk
Subject: How to create Array of Structures
Hi all,
How do we create Array of Structures in ColdFusion? As an example I have a
query to get the list of employees and I need to create it as an array of
structures. How do you populate data and how can we retrieve it?
Example Query:
<cfquery name="getEmployee"
datasource="test"
dbtype="ODBC">
select ssn, firstName, lastName from employee
</cfquery>
Thanks,
Ajoy
______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup
------------------------------------------------------------------------------
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.