Here's a follow up to bmacman's Check Box Problem posted on 11/7:
I have a data entry page (UpdateDetail.cfm) which allows the user to either update or bypass numerous (5-30) actl_perf_amt records. This, and a number of other hidden fields, are then passed to the action page (UpdatePerf.cfm) in a comma delimited list. I first use the ListContains to cull out any bypasses (BypassMthCheck) and then use ListGetAt to refer to the variables which are in a comma delimited list form. I then want to save ALL changes with one submit and display results on the original data entry page (UpdateDetail.cfm).
The data is passed to the action page as follows:
N,Y,N,Y,Y,Y,Y,N,Y,N,N (Bypass Y/N currently reads)
N,N,Y,N,N,N,N,Y,N,Y,Y (Bypass Y/N should read)
77.4500,2.4,.0000,.4635,103.50,25.7319,1658.00,.0000,1.0,.0000,.0000 (Data Entry)
(The data records are correct, but the Bypass is only correct for the first record and exactly the opposite for all others)
Here's my code: What am I doing wrong?
UpdatePerf.cfm (Action Page)
<CFTRANSACTION>
<CFLOOP Index="ListRead"
From ="1" To="#FormrecCount#">
<CFPARAM NAME="BypassMthCheck" DEFAULT="No">
<CFIF #BypassMthCheck# IS "No">
<CFSET ignore_month = "N">
<CFSET msur_actl_perf_amt = #ListGetAt(form.actl_perf_amt, ListRead, ","
#>
<CFELSEIF ListContains(BypassMthCheck, ListRead, ","
>
<CFSET ignore_month = "N">
<CFSET msur_actl_perf_amt = #ListGetAt(form.actl_perf_amt, ListRead, ","
#>
<CFELSE>
<CFSET ignore_month = "Y">
<CFSET msur_actl_perf_amt = 0>
</CFIF>
<CFSET actl_perf_amt = #VAL(msur_actl_perf_amt)#>
<CFSET expc_perf_amt = ListGetAt(form.expc_perf_amt, ListRead, ","
>
etc...
<!-- Get perfRecords -->
<CFQUERY NAME="GetPerf" DATASOURCE="PGM">
SELECT *
FROM Performance
WHERE Performance.dlvr_id = #ListGetAt(form.dlvr_id, ListRead, ","
#
AND Performance.msur_id = #ListGetAt(form.msur_id, ListRead, ","
#
AND Performance.perf_date = #ODBCSelectedDate#
</CFQUERY>
<CFIF GetPerf.RecordCount IS 0>
<CFQUERY NAME="InsertPerf" DATASOURCE="PGM">
INSERT INTO Performance(perf_date, actl_perf_amt, dlvr_id, msur_id, ignore_month)
VALUES (#ODBCSelectedDate#, '#msur_actl_perf_amt#', #dlvr_id#, #msur_id#, '#ignore_month#')
</CFQUERY>
<CFELSE>
<CFQUERY NAME="UpdtPerf" DATASOURCE="PGM">
UPDATE Performance
SET actl_perf_amt = '#msur_actl_perf_amt#',
ignore_month = '#ignore_month#'
WHERE dlvr_id = #ListGetAt(form.dlvr_id, ListRead, ","
#
AND msur_id = #ListGetAt(form.msur_id, ListRead, ","
#
AND perf_date = #perf_date#
</CFQUERY>
</CFIF>
<CFINCLUDE TEMPLATE="CalcPGM.cfm">
<CFQUERY NAME="UpdtPerf" DATASOURCE="PGM">
UPDATE Performance
SET mth_pog = #mth_pog#,
ytd_perf = #ytd_perf#,
ytd_pog = #ytd_pog#
WHERE dlvr_id = #ListGetAt(form.dlvr_id, ListRead, ","
#
AND msur_id = #ListGetAt(form.msur_id, ListRead, ","
#
AND perf_date = #ODBCSelectedDate#
</CFQUERY>
</CFLOOP>
</CFTRANSACTION>
<CFINCLUDE TEMPLATE="UpdateDetail.cfm">
I have a data entry page (UpdateDetail.cfm) which allows the user to either update or bypass numerous (5-30) actl_perf_amt records. This, and a number of other hidden fields, are then passed to the action page (UpdatePerf.cfm) in a comma delimited list. I first use the ListContains to cull out any bypasses (BypassMthCheck) and then use ListGetAt to refer to the variables which are in a comma delimited list form. I then want to save ALL changes with one submit and display results on the original data entry page (UpdateDetail.cfm).
The data is passed to the action page as follows:
N,Y,N,Y,Y,Y,Y,N,Y,N,N (Bypass Y/N currently reads)
N,N,Y,N,N,N,N,Y,N,Y,Y (Bypass Y/N should read)
77.4500,2.4,.0000,.4635,103.50,25.7319,1658.00,.0000,1.0,.0000,.0000 (Data Entry)
(The data records are correct, but the Bypass is only correct for the first record and exactly the opposite for all others)
Here's my code: What am I doing wrong?
UpdatePerf.cfm (Action Page)
<CFTRANSACTION>
<CFLOOP Index="ListRead"
From ="1" To="#FormrecCount#">
<CFPARAM NAME="BypassMthCheck" DEFAULT="No">
<CFIF #BypassMthCheck# IS "No">
<CFSET ignore_month = "N">
<CFSET msur_actl_perf_amt = #ListGetAt(form.actl_perf_amt, ListRead, ","

<CFELSEIF ListContains(BypassMthCheck, ListRead, ","

<CFSET ignore_month = "N">
<CFSET msur_actl_perf_amt = #ListGetAt(form.actl_perf_amt, ListRead, ","

<CFELSE>
<CFSET ignore_month = "Y">
<CFSET msur_actl_perf_amt = 0>
</CFIF>
<CFSET actl_perf_amt = #VAL(msur_actl_perf_amt)#>
<CFSET expc_perf_amt = ListGetAt(form.expc_perf_amt, ListRead, ","

etc...
<!-- Get perfRecords -->
<CFQUERY NAME="GetPerf" DATASOURCE="PGM">
SELECT *
FROM Performance
WHERE Performance.dlvr_id = #ListGetAt(form.dlvr_id, ListRead, ","

AND Performance.msur_id = #ListGetAt(form.msur_id, ListRead, ","

AND Performance.perf_date = #ODBCSelectedDate#
</CFQUERY>
<CFIF GetPerf.RecordCount IS 0>
<CFQUERY NAME="InsertPerf" DATASOURCE="PGM">
INSERT INTO Performance(perf_date, actl_perf_amt, dlvr_id, msur_id, ignore_month)
VALUES (#ODBCSelectedDate#, '#msur_actl_perf_amt#', #dlvr_id#, #msur_id#, '#ignore_month#')
</CFQUERY>
<CFELSE>
<CFQUERY NAME="UpdtPerf" DATASOURCE="PGM">
UPDATE Performance
SET actl_perf_amt = '#msur_actl_perf_amt#',
ignore_month = '#ignore_month#'
WHERE dlvr_id = #ListGetAt(form.dlvr_id, ListRead, ","

AND msur_id = #ListGetAt(form.msur_id, ListRead, ","

AND perf_date = #perf_date#
</CFQUERY>
</CFIF>
<CFINCLUDE TEMPLATE="CalcPGM.cfm">
<CFQUERY NAME="UpdtPerf" DATASOURCE="PGM">
UPDATE Performance
SET mth_pog = #mth_pog#,
ytd_perf = #ytd_perf#,
ytd_pog = #ytd_pog#
WHERE dlvr_id = #ListGetAt(form.dlvr_id, ListRead, ","

AND msur_id = #ListGetAt(form.msur_id, ListRead, ","

AND perf_date = #ODBCSelectedDate#
</CFQUERY>
</CFLOOP>
</CFTRANSACTION>
<CFINCLUDE TEMPLATE="UpdateDetail.cfm">