Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Follow Up to Check Box Problem

Status
Not open for further replies.

CFDev

Programmer
Joined
Aug 24, 2001
Messages
8
Location
US
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=&quot;ListRead&quot;
From =&quot;1&quot; To=&quot;#FormrecCount#&quot;>

<CFPARAM NAME=&quot;BypassMthCheck&quot; DEFAULT=&quot;No&quot;>
<CFIF #BypassMthCheck# IS &quot;No&quot;>
<CFSET ignore_month = &quot;N&quot;>
<CFSET msur_actl_perf_amt = #ListGetAt(form.actl_perf_amt, ListRead, &quot;,&quot;)#>

<CFELSEIF ListContains(BypassMthCheck, ListRead, &quot;,&quot;)>

<CFSET ignore_month = &quot;N&quot;>
<CFSET msur_actl_perf_amt = #ListGetAt(form.actl_perf_amt, ListRead, &quot;,&quot;)#>
<CFELSE>
<CFSET ignore_month = &quot;Y&quot;>
<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, &quot;,&quot;)>
etc...

<!-- Get perfRecords -->
<CFQUERY NAME=&quot;GetPerf&quot; DATASOURCE=&quot;PGM&quot;>
SELECT *
FROM Performance
WHERE Performance.dlvr_id = #ListGetAt(form.dlvr_id, ListRead, &quot;,&quot;)#
AND Performance.msur_id = #ListGetAt(form.msur_id, ListRead, &quot;,&quot;)#
AND Performance.perf_date = #ODBCSelectedDate#
</CFQUERY>


<CFIF GetPerf.RecordCount IS 0>
<CFQUERY NAME=&quot;InsertPerf&quot; DATASOURCE=&quot;PGM&quot;>
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=&quot;UpdtPerf&quot; DATASOURCE=&quot;PGM&quot;>
UPDATE Performance
SET actl_perf_amt = '#msur_actl_perf_amt#',
ignore_month = '#ignore_month#'
WHERE dlvr_id = #ListGetAt(form.dlvr_id, ListRead, &quot;,&quot;)#
AND msur_id = #ListGetAt(form.msur_id, ListRead, &quot;,&quot;)#
AND perf_date = #perf_date#
</CFQUERY>
</CFIF>

<CFINCLUDE TEMPLATE=&quot;CalcPGM.cfm&quot;>

<CFQUERY NAME=&quot;UpdtPerf&quot; DATASOURCE=&quot;PGM&quot;>
UPDATE Performance
SET mth_pog = #mth_pog#,
ytd_perf = #ytd_perf#,
ytd_pog = #ytd_pog#
WHERE dlvr_id = #ListGetAt(form.dlvr_id, ListRead, &quot;,&quot;)#
AND msur_id = #ListGetAt(form.msur_id, ListRead, &quot;,&quot;)#
AND perf_date = #ODBCSelectedDate#

</CFQUERY>
</CFLOOP>
</CFTRANSACTION>
<CFINCLUDE TEMPLATE=&quot;UpdateDetail.cfm&quot;>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top