Pan,

The problem turned out to be that some rows in the db table had null values.
Apparently an array doesn't like that. When I populated the empty db rows
with 0 in all columns, the arraySum function liked that fine.

Thanks for taking the time to look at this problem.

Paul


> -----Original Message-----
> From: pan [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, October 25, 2000 11:14 PM
> To: CF-Talk
> Subject: Re: Help with ArraySum
>
>
>
>
> > From: Paul Sinclair [mailto:[EMAIL PROTECTED]]
> >
> > I'm setting an array and trying to get the sum of the values.
> The array is
> > populated from the contents of a "Number" field in an MSAccess
> table. The
> > error I get is:
> >
> > "In function ArraySum the element at position 1 is not a real
> value. Please
> > make sure that the function's first argument contains only real values"
> >
> > When I convert the array to a list, it outputs the following as
> the contents
> > of the array:
> >
> >
> 3.0,2.0,0.0,3.5,0.5,0.0,1.0,0.0,3.0,2.0,2.0,4.5,3.0,0.0,0.0,6.0,4.
> 5,9.0,0.0,
> > 3.0,
> >
> > What might be the trouble?
> >
>
> Testing with the following code shows:
> <cfset
> L="3.0,2.0,0.0,3.5,0.5,0.0,1.0,0.0,3.0,2.0,2.0,4.5,3.0,0.0,0.0,6.0
> ,4.5,9.0,0.0,3
> .0,">
> <cfset A=ListToArray(L)>
> <cfset S=arraySum(A)>
> <cfoutput>#S#</cfoutput>
> ::ANSWER=47::
>
> No problem with the data as presented.
> All the values are real numbers.
> What is the datatype for the field in the db?
> What code do you use to retrieve the data?
> You might try conditioning the data with
> val(trim(data)).
>
> Pan
>
>
>
> ------------------------------------------------------------------
> ------------------------------
> Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
> or send a message with 'unsubscribe' in the body to
> [EMAIL PROTECTED]
>

------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to