If it’s a query structure your after you can just use... a query structure

Eg.

<cfset person = QueryNew("fname,lname,email")>

<cfset QueryAddRow(person)>
<cfset QuerySetCell(person, "fname" "John")>
<cfset querySetCell(person, "lname", "Doe")>
<cfset QuerySetCell(person, "email", "[EMAIL PROTECTED]")>

<cfset QueryAddRow(person)>
<cfset QuerySetCell(person, "fname" "Jone")>
<cfset querySetCell(person, "lname", "Doe")>
<cfset QuerySetCell(person, "email", "[EMAIL PROTECTED]")>

<cfdump var"#person#">

You can add rows to that all day long. keeping with the sort of 'class
object' your describing you can also scope the queries and make them subs of
a higher structure.

Eg.


<cfset obj.person = QueryNew("fname,lname,email")>

<cfset QueryAddRow(obj.person)>
<cfset QuerySetCell(obj.person, "fname", "John")>
<cfset QuerySetCell(obj.person, "lname", "Doe")>
<cfset QuerySetCell(obj.person, "email", "[EMAIL PROTECTED]")>

<cfset QueryAddRow(obj.person)>
<cfset QuerySetCell(obj.person, "fname", "Jane")>
<cfset QuerySetCell(obj.person, "lname", "Doe")>
<cfset QuerySetCell(obj.person, "email", "[EMAIL PROTECTED]")>


<cfset obj.dog = QueryNew("color,name,breed")>
<cfset QueryAddRow(obj.dog)>
<cfset QuerySetCell(obj.dog, "color", "Black/White")>
<cfset querySetCell(obj.dog, "name", "Bandit")>
<cfset QuerySetCell(obj.dog, "breed", "dalmation")>

<cfset QueryAddRow(obj.dog)>
<cfset QuerySetCell(obj.dog, "color", "White")>
<cfset querySetCell(obj.dog, "name", "Sandy")>
<cfset QuerySetCell(obj.dog, "breed", "Toy Poodle")>

<cfdump var="#obj#">



-----Original Message-----
From: Thane Sherrington [mailto:[EMAIL PROTECTED] 
Sent: Sunday, April 24, 2005 11:21 AM
To: CF-Talk
Subject: Structures (probably a stupid question)

I'm trying to understand structures - I understand that they are like the 
form scope in that I can access them as myStruct.myVar, but is there a way 
to create an array of structures?  I'm thinking it would be nice to create 
a structure like:

myStruct.FName
myStruct.LName
myStruct.EMail

And then add people to that sort of like a virtual table that I could later 
loop through and add to a real table.

It appears from the reading I've done that one can, but I can't find a 
clear example of it.  I'm looking for something will work in CF5 and up.

Thanks,

T

---
[This E-mail scanned for viruses by Declude Anti-Virus]




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:204171
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to