I pretty much always use an array of structs for this sort of situation. 
I like the descriptive name of the key names in the struct (user.name, 
user.lastseen, user.event) and I like the ease of the array functions 
for looping over, appending and counting. That way I can just loop from 
1 to ArrayLen and then easily reference the structure for each loop and 
output what I'm really interested in (name, event, etc).

I don't use two-dimensional arrays much because usually if I have 
related data there is some natural, descriptive, relationship beyond 
numeric indices and I like to keep that information. In this case its 
that all off the first entries in each row is a Name, the second is the 
  date LastSeen, etc. If the data in each row was unstructured, say a 
series of numbers picked for the lottery, then I would probably use a 
two-dimensional array because data doesn't have any useful keys 
associated with it.

In the same fashion, I wouldn't use a structure of structs because each 
row is just a row, there isn't a natural key that uniquely describes 
each row, it just has an index.

Cheers,
Judah

Robert Rawlins - Think Blue wrote:
> Hello Guys,
> 
>  
> 
> I'm looking for some advice on whether I should be using a 2 dimensional
> array or a array of structs for this kind of thing. I'm looking to store a
> list of users in an array, but also some other information on them, similar
> to a virtual table I guess, like this.
> 
>  
> 
> Name                    LastSeen              Event
> 
> Rob                        01-01-2007          Emailing
> 
> Dave                      01-01-2007          News
> 
> John                      02-01-2007          Users
> 
> Paul                       03-01-2007          Emailing
> 
>  
> 
> Now should i be creating an array of structs for this? With each element of
> the array containing a structure with name, lastseen and event in it? Or
> should I just use a two dimensional array? Is there any real benefit between
> the two for performance?
> 
>  
> 
> Or perhaps I use a struct of structs? So then I can do
> Application.Userlist.Rob.LastSeen or something like that? Is it possible to
> dynamically name a structure key?
> 
>  
> 
> Thanks,
> 
>  
> 
> Rob



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:278982
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to