Yeah, it only works on single dimension arrays.  WIth your data, you could
sum up one of the rows just fine, but not a column.  This will do it though:

sum = 0;
for (i = 1; i LT arrayLen(mytgarray); i = i + 1)
   sum = sum + mytgarray[i][6];



---
Barney Boisvert, Senior Development Engineer
AudienceCentral (formerly PIER System, Inc.)
[EMAIL PROTECTED]
voice : 360.756.8080 x12
fax   : 360.647.5351

www.audiencecentral.com

> -----Original Message-----
> From: DURETTE, STEVEN J (AIT) [mailto:[EMAIL PROTECTED]
> Sent: Monday, June 02, 2003 2:25 PM
> To: CF-Talk
> Subject: Array sum question.
>
>
> 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

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

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

Reply via email to