|
[x]
Posted via EE Mobile
|
|
| Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
|
|
|
|
Asked by firstheartland in ColdFusion Studio, Cold Fusion Markup Language, SQL Query Syntax
OK.
I'm trying to loop through a set of results from a database and then apply apply a formula and update the records. I'm pretty sure that this WAS WORKING before and now is not. The SQL Statements are valid and work if I copy and paste them direct into the database. They seem to not be executing within the loop (which is the big time saver for the data entry person)
I receive no error message.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
|
<cfloop query="MarginToAdjust" >
<!--- Calculate Bonus ---->
<cfif (MarginToAdjust.Gross - MarginToAdjust.StreetDirect) GTE arguments.maximum>
<cfset newbonus = arguments.normalBonus>
<cfelse>
<cfset newbonus = (arguments.percentage / 100) * (MarginToAdjust.Gross - MarginToAdjust.StreetDirect) >
<cfset newbonus = int(newbonus)>
</cfif>
<cfquery name="update" datasource="ComSched" result="result">
UPDATE AgentPayout
SET Bonus = #newbonus#
WHERE (PayoutID = #MarginToAdjust.PayoutID#)
</cfquery>
<cfoutput>
<tr>
<td colspan="9"><cfdump var="#result#"> </td>
|
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625