> 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/[email protected]/
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