So wait, you just want to sort the keys themselves? If so: <cfset sorted = listSort(structKeyList(thedata), "numeric")>
Sorted is then a sorted list of keys. You loop over your struct using the sorted list to access the keys. On 6/20/05, Che Vilnonis <[EMAIL PROTECTED]> wrote: > Ray, All I want is to sort the structure's Key... which is the product's SKU > so customers see their products in their shopping cart ordered by sku. This > used to work on CF5, in MX I understand things are different. A dump looks > like this. What could i do to order these by SKU? (i.e. 20068, 3135, 9112). > Thanks, Che. > > struct > 3135 array > 1 10194 > 2 1 > 3 9.9500 > 4 White/Pink Bear > 5 3135 > 9112 array > 1 5418 > 2 1 > 3 15.0000 > 4 NA > 5 NA > 20068 array > 1 9877 > 2 1 > 3 16.9500 > 4 Size 000 > 5 20068 > > -----Original Message----- > From: Raymond Camden [mailto:[EMAIL PROTECTED] > Sent: Monday, June 20, 2005 10:54 AM > To: CF-Talk > Subject: Re: StructSort Question... I am stumped. > > > StructSort returns a value. It doesn't sort the data as is. > > On 6/20/05, Che Vilnonis <[EMAIL PROTECTED]> wrote: > > Hello all. I have a structure of arrays that I need to sort for my > shopping > > cart. The structure is "stWSShoppingBasket" and the key that holds the > > arrays is "BasketSKU". I need to sort this stucture of arrays based on > > "BasketSKU". I am stumped as to why I can't get this to work. What should > my > > StructSort line say [last line of code]? > > > > > > <cfscript> > > if (NOT isDefined("stWSShoppingBasket")) { > > // Check to make sure that the Shopping cart structure > exists. > > stWSShoppingBasket = structNew(); > > } > > > > tempValue = > > > ListToArray('#Product_ID#,#Quantity#,#WS_Price#,#OptTitle#,#OptPartNumber#') > > ; > > > > // If the item is not yet in the cart, simply add it to the cart. > > if (NOT(StructKeyExists(stWSShoppingBasket, BasketSKU))) { > > StructInsert(stWSShoppingBasket,BasketSKU,tempValue); > > > > // > StructSort(stWSShoppingBasket,"Numeric","ASC",BasketSKU); > > } > > </cfscript> > > > > > > Thanks, Che > > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:209985 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

