Yeah I didn't realize I was recreating the array at every iteration,
that was an oversight. clicks_per_product.click[i] is a query but I
thought by putting setting prodLinkTotal which is an array to
clicks_per_product.click[i] would turn that into an array? I can get the
values I need just can't seem to add them together. Any ideas?

Ben

-----Original Message-----
From: Philip Arnold [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 19, 2003 12:08 PM
To: CF-Talk
Subject: RE: Array Sum

Why are you re-creating the array every iteration of the loop?

Also, is clicks_per_product.click[i] an array? if not, then you can't
ArraySum it

-----Original Message-----
From: Ben Densmore [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 19, 2003 11:51 AM
To: CF-Talk
Subject: Array Sum

Can someone tell me why this won't work correctly. I have the following
code

<code>
<cfloop from="1" to="#clickCount#" index="i">
<cfset prodLinkTotal = ArrayNew(1)>
<cfset prodLinkTotal[i] = clicks_per_product.click[i]>
<cfoutput>#ArraySum(prodLinkTotal[i])#</cfoutput>
</cfloop>
</code>

Rightnow the clickcount is at 4 so if I output just prodLinkTotal[i] I
get the total number of clicks for each product(303 289 95 89). I now
need to add these up and thought ArraySum() would do it but I keep
getting this error:

Object of type class java.lang.Integer cannot be used as an array

Is there a better way to accomplish this?

Thanks,
Ben
  _____  


  _____  


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to