[thelist] CF_Shoppingcart, aligning lists (REPOST?)

Judah McAuley judah at wiredotter.com
Fri Jul 13 00:47:46 CDT 2001


At 09:04 PM 7/12/2001 -0700, .jeff wrote:
<snip>

><cfloop from="1" to="#getall.recordcount#" index="currentrow">
>   <cfset quantity = ListGetAt(qty, ListFind(item,
>getall["id"][currentrow]))>
>   <cfset getall["quantity"][currentrow] = quantity>
></cfloop>
</snip>

I concur with .jeff, but for the sake of readability, I would change

<cfset getall["quantity"][currentrow] = quantity>

to

<cfset QuerySetCell('getall', 'quantity', quantity, currentrow)>

This syntax obviously tells me that I'm manipulating a query.  .jeff's 
associative array syntax is correct (and he gets the award for two 
associative array solutions in one day), but I think that the QuerySetCell 
syntax will be more obvious when reading the code 3 months later.

Further evidence that there is more than two ways to skin a cat and more 
than five ways to do anything with data structures in CF.

My $.02,

Judah





More information about the thelist mailing list