I am probably misunderstanding the MX docs regarding a structure's order.
"MX returns structure keys in the order they are created. CF5 returned keys
in alpha order."
Am building a structure of Stallions from a query that has ORDER BY
SortOrder.
SortOrder is a number (byte) field in an Access database.
If dump the structure, the order is alpha by StallionCode, not by the
SortOrder.
If output the query, it is outputted according to SortOrder.
When loop over the structure as a collection, the order does not follow
either alpha or sortOrder.
In CF5, I had to reorder the structure to get what I desired. I thought in
MX I wouldn't have to do that.
Here is basic part of routine:
<CFQuery name="qStalls" datasource="#request.datasource#">
SELECT *
FROM tStallions
WHERE Status = <cfqueryparam cfsqltype="cf_sql_varchar" value="Active"
/>
ORDER BY SortOrder, StallionName
</cfquery>
<!--- then create stStallions --->
<CFSet stStallions = StructNew()>
<CFLoop query="qStalls">
<CFSet stStallions[StallionCode] = StructNew()>
<CFSet stStallions[StallionCode].Code = StallionCode>
<CFSet stStallions[StallionCode].Name = StallionName>
<CFSet stStallions[StallionCode].Fee = StudFee>
etc, etc
</cfloop>
All this works fine, other than since it's created from the query that was
ordered by SortOrder, I thought the order would be "in which it was created"
not alpha.
For output, I'm using:
<CFLoop collection="#request.stStallions#" item="s">
name: #request.stStallions.[s].Name# <br />
</cfloop>
This loop produces:
code (SortOrder--not listed, but shown here to illustrate)
Ops 15
Moon 10
Dixie 20
Test 50
In the dump of structure, the order is:
Dixie 20
Moon 10
Ops 15
Test 50
Appreciate any insight into what difference there is between CF5 and MX with
order. I was hoping in MX that I wouldn't have to do any reordering routine
to get the order I desired.
Thanks
E. Keith Dodd
Wings of Eagles Services
www.wingserv.com
-
[This E-mail scanned for viruses by declude AntiVirus Software]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4