ez007
ez007

Reputation: 147

COLDFUSION - Finding the sum of rows in a table

I have a table where it outputs all orders placed within a certain date and need to output the total at the end of each row (for the Total VAT + Net Value).

I get the error 'Complex object types cannot be converted to simple values'

What is the simplest way to over come this?

<cfquery name="getPrice" dbtype="query">
  select sum(TotalVAT+NetValue) as grandTotal
  from AllOrders
</cfquery>

and in my table:

 <CFOUTPUT query="AllOrders">
<tr>
<td width="200px">#AllOrders.PurchaseDate#</td>
<td>#AllOrders.Description#</td>
<td>#AllOrders.TotalVAT#</td>
<td>#AllOrders.NetValue#</td>
<td>#getPrice.grandTotal#</td>
</tr>

Upvotes: 0

Views: 432

Answers (1)

Chris Brickhouse
Chris Brickhouse

Reputation: 648

getprice.grandtotal is what you would output.

you are trying to output the entire query.

Upvotes: 2

Related Questions