A 2D array is actually an array of 1D arrays, so... in your example, row1 is an array, 
row2 is an array, and row3 is an array... So you could get an arraysum on any of those 
rows by using arraysum(mytgtarray[myrownum]), however, arraysum only works on a 
single-dimensional array (which mytgtarray[myrownum] is because you're selecting out 
that row which is another array), so if you want to get a sum for col6 you have to 
either reverse the dimensions (so that what are on the rows now are along the columns 
and vice versa), and select arraysum(mytgtarray[6]) or you have to manually build an 
array or a sum from each individual row. You might want to check cflib.org for some 
UDF's to manage arrays with. :)

hth

> All,

> I am trying to do a strange array sum and it won't work.

> First let me state that the is a multi-dimension array and
> to give an idea
> of what it looks like:

> mytgtarray[row][col]
>      |COL1|COL2|COL3|COL4|COL5|COL6|
> row 1| 1  | 2  | 3  | 4  | 5  | 6  |
> row 2| 2  | 3  | 4  | 5  | 6  | 7  |
> row 3| 3  | 4  | 5  | 6  | 7  | 8  |

> I am trying to sum up column 6. (result should be 21)
> Of course this isn't my real data.

> I tried myTot = arraySum(mytgtarray[][6]) and got the
> error invalid cfml
> construct ]

> so I tried myTot = arraySum(mytgtarray[*][6] and got the
> error invalid cfml
> construct *

> does anyone have any ideas of how to do this, or can it
> even be done?  Does
> arraysum only work on single dimension arrays?

> Thanks,
> Steve
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~|
> 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/uns
>                               ubscribe.cfm?user=633.558.4



s. isaac dealey                972-490-6624

new epoch                      http://www.turnkey.to

lead architect, tapestry cms   http://products.turnkey.to

tapestry api is opensource     http://www.turnkey.to/tapi

certified advanced coldfusion 5 developer
http://www.macromedia.com/v1/handlers/index.cfm?ID=21816


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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.
http://www.cfhosting.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to