Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
ixnay5 #1
type conversion error totaling values in array ofstructures
Hi all - I'm trying to accumulate a total from a value within an array of
structures, but I keep getting a data conversion error. It refuses to
recognize the value as a number, though every indication says it is. This is
the line that's throwing the error (near the bottom below): <cfset thetotal =
thetotal + (session.rec.list)> I don't understand why the value isn't being
seen as a number, and I don't know what I can do to convert it first. Please
help! here's the code:
<cfset thetotal = 0>
<cflock name="lockOutput" timeout="5">
<table width="950" align="center" border="1" bordercolor="silver"
cellpadding="1" cellspacing="0">
<tr>
<td class="leftdetail" width="50"><b>S/O</b></td>
<td class="centerdetail" width="100"><b>Ship Date</b></td>
<td class="centerdetail" width="100"><b>Cust ID</b></td>
<td class="centerdetail" width="100"><b>Cust PO</b></td>
<td class="centerdetail" width="60"><b>Invoice</b></td>
<td class="centerdetail" width="100"><b>Product</b></td>
<td class="centerdetail" width="275"><b>Desc</b></td>
<td class="centerdetail" width="30"><b>Qty</b></td>
<td class="centerdetail" width="100"><b>S/N</b></td>
<td class="rightdetail" width="100"><b>Extended List Price</b></td>
</tr>
<cfloop from="1" to="#arraylen(session.rec)#" index="i">
<tr>
<cfoutput>
<td class="leftdetail">#session.rec[i].indoc#</td>
<td class="centerdetail">#session.rec[i].sotadat#</td>
<td class="centerdetail">#session.rec[i].cust#</td>
<td class="centerdetail">#session.rec[i].custpon#</td>
<td class="centerdetail">#session.rec[i].invoice#</td>
<td class="centerdetail">#session.rec[i].product#</td>
<td class="centerdetail">#session.rec[i].proddesc#</td>
<td
class="rightdetail">#numberformat(session.rec[i].solsqty,'999,999,999,999')#</td<td class="centerdetail">#session.rec[i].serln#</td>>
<td
class="rightdetail">#numberformat(session.rec[i].list,'999,999,999,999')#</td>
</cfoutput>
</tr>
<cfset thetotal = thetotal + (session.rec[i].list)>
<cfset thetotal = numberformat(thetotal,'999,999,999,999')>
</cfloop>
ixnay5 Guest
-
Totaling instance in an array
I need to be able to total the number of instance a product goes into to my shopping cart. I have my shopping cart array looping over a query that... -
#25816 [Opn->Ver]: Class constants of type array hold directly inaccessible keys/values
ID: 25816 Updated by: helly@php.net Reported By: dan at wep dot net -Status: Open +Status: Verified... -
#25816 [Opn]: Class constants of type array hold directly inaccessible keys/values
ID: 25816 User updated by: dan at wep dot net Reported By: dan at wep dot net Status: Open Bug Type: ... -
#25816 [NEW]: Class constants of type array hold directly inaccessible keys/values
From: dan at wep dot net Operating system: Linux (Redhat 9, 2.4.22) PHP version: 5CVS-2003-10-10 (dev) PHP Bug Type: ... -
Array to string conversion error - why?
I get the following error: Notice: Array to string conversion in C:\Documents and Settings\ShepMode\Desktop\Websites\ShareMonkey.net\Web\join.php...



Reply With Quote

