I've get an xml packet that returns qty available per warehouse, and I
want to add up all of the qty's and return a total, but I am getting a
crash when I try and use the sum in the xpath statement.

The xml looks like this.

<LineInfo>
<WhseInfo>
        <IDCode>MIAMI, FL</IDCode>
        <Qty>9642</Qty>
</WhseInfo>
<WhseInfo>
        <IDCode>NORCROSS, GA</IDCode>
        <Qty>7475</Qty>
</WhseInfo>
<WhseInfo>
        <IDCode>PAULSBORO, NJ</IDCode>
        <Qty>-4</Qty>
</WhseInfo>
</LineInfo>

Here is the code I have currently.

<cfset lineInfo = xmlSearch(xmlObj, "/XML_Availability_Response/Detail/LineInfo")>
<cfloop from="1" to="#arrayLen(lineinfo)#" index="i">
        <cfset whseQty = xmlSearch(lineinfo[i], "sum(WhseInfo/Qty)")>
</cfloop>

To be honest, I've never seen the sum function used this way, only in
full blown style sheets...but from what I understand it should work.
Anyone know what I'm doing wrong?

This is the error I get.

Can not convert #NUMBER to a NodeList!

on this line:
<cfset whse = xmlSearch(lineinfo[i], "sum(WhseInfo/Qty)")>

Trace starts with this.
coldfusion.xml.XmlProcessException: Can not convert #NUMBER to a NodeList!
-- 
 jon
  mailto:[EMAIL PROTECTED]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to