ArraySum的列表

Gos*_*osi 0 coldfusion

我试图在列表中添加所有数字的所有值.

所以这就是我的尝试,

<cfloop query="get_total_merchant">
    <cfset tx_amt_total = #tx_amount# + (#tx_amount# * (#merchantFee#/100))>
    #ArraySum(tx_amt_total)#
</cfloop> 
Run Code Online (Sandbox Code Playgroud)

所以基本上tx_amt_total会显示的是什么1 2 3 4.所以我想添加1 + 2 + 3 + 4,这应该给我10.

但是,根据我的尝试,我收到一条错误消息: Object of type class java.lang.Double cannot be used as an array

那我该如何修复我的代码呢?

小智 5

<cfset tx_amt_total = 0 />

<cfloop query="get_total_merchant">
    <cfset tx_amt_total += (tx_amount + (tx_amount * (merchantFee/100))) />
</cfloop> 
Run Code Online (Sandbox Code Playgroud)

应该够了.你不需要arraySum()