What would be the best way to achieve this? So far this is my code (but I am certainly not saying this is the best way to calculate a total); it is not calculating anything, just displaying a 0 (so it must be at least syntactically correct).
<cfset ChargeTot=0>
<cfif isdefined("NarAmt") or isdefined("ChargeAmt")>
<cfif GetPOonly.recordcount LT GetGLInfo.recordcount>
<cfloop query="GetGLInfo">
<cfset ChargeTot=ChargeTot+#NarAmt#+#ChargeAmt#>
</cfloop>
<cfelse>
<cfloop query="GetPOInfo">
<cfset ChargeTot=ChargeTot+#NarAmt#+#ChargeAmt#>
</cfloop>
</cfif>
</cfif>
<cfset ChargeTot=0>
<cfif isdefined("NarAmt") or isdefined("ChargeAmt")>
<cfif GetPOonly.recordcount LT GetGLInfo.recordcount>
<cfloop query="GetGLInfo">
<cfset ChargeTot=ChargeTot+#NarAmt#+#ChargeAmt#>
</cfloop>
<cfelse>
<cfloop query="GetPOInfo">
<cfset ChargeTot=ChargeTot+#NarAmt#+#ChargeAmt#>
</cfloop>
</cfif>
</cfif>