Structs are NOT ordered. Therefore, there is no set way that it will
be presented. As it stands, you normally would store the data as is in
the db, and do presentation on the client.

On 6/20/05, Che Vilnonis <[EMAIL PROTECTED]> wrote:
> So, that is for 'presentation only'? Is there any way to re-sort how the
> data is 'held' and subsequently, written to a database?
> 
> Thanks, Che
> 
> -----Original Message-----
> From: Raymond Camden [mailto:[EMAIL PROTECTED]
> Sent: Monday, June 20, 2005 11:18 AM
> To: CF-Talk
> Subject: Re: StructSort Question... I am stumped.
> 
> 
> 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
> > >
> > >
> > >
> >
> >
> >
> >
> 
> 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:210004
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=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to