Hi folks,
Does anyone know of a way to preserve the order of keys in a structure so
that it matches the order in which it was created?
i.e.
I created a structure that looks like so:
instance structNew();
instance["id"] = structNew();
instance["id"].heading = "Id";
instance["id"].size = 50;
instance["manufacturer_name"] = structNew();
instance["manufacturer_name"].heading = "MFG";
instance["manufacturer_name"].size = 200;
instance["name"] = structNew();
instance["name"].heading = "Name";
instance["name"].size = 100;
instance["parttype_name"] = structNew();
instance["parttype_name"].heading = "Part Type";
instance["parttype_name"].size = 100;
instance["status_name"] = structNew();
instance["status_name"].heading = "Status";
instance["status_name"].size = 100;
When I cfloop through it ( i.e. for ( field in instance ) {} ), I would
expect it to find the "id" field first, then "manufacturer_name", and so on
and so fourth in the order in which the structure was created. Instead it
loops through in this order:
name,id,parttype_name,manufacturer_name,status_name
I figured I'd try to trick it by doing a structKeyList() then cflooping
through that, but it returns the same thing:
name,id,parttype_name,manufacturer_name,status_name
Does anyone know of a way to cfloop through this structure in the order in
which it was created: id,manufacturer_name,name,parttype_name,status_name ?
TIA!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community.
http://www.fusionauthority.com/ads.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4