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!

ListDelimiter problem with ListContains & ListGetAt

Status
Not open for further replies.

CFDev

Programmer
Joined
Aug 24, 2001
Messages
8
Location
US
This one is killing me!!
I am trying to use the ListContains and ListGetAt functions to update a list that has been passed from an array. I am using the default delimiter (comma). The values are passing to the action page as numerics such as .00, .00, l25.29, etc. I first look to see if the record has been "bypassed", if so, the value is 0. Otherwise, update based on current input. However, the update fails with the following error.

Error Diagnostic Information
An error occurred while evaluating the expression:
ListContains(BypassMthCheck, LoopCounter, ",") IS 0
Error near line 19, column 53.

Error resolving parameter LOOPCOUNTER
ColdFusion was unable to determine the value of the parameter. This problem is very likely due to the fact that either:
1. You have misspelled the parameter name, or
2. You have not specified a QUERY attribute for a CFOUTPUT, CFMAIL, or CFTABLE tag.
The error occurred while processing an element with a general identifier of (CFIF), occupying document position (19:1) to (19:58) in the template file D:\Inetpub\ development\docs\inside_tg\planning\pgm\UpdatePerf.cfm.

My code is attached.

<CFIF ListContains(BypassMthCheck, LoopCounter, &quot;,&quot;) IS 0>

<CFSET ignore_month = &quot;N&quot;>
<CFSET msur_actl_perf_amt = #ListGetAt(actl_perf_amt, LoopCounter)#>
<CFELSE>
<CFSET ignore_month = &quot;Y&quot;>
<CFSET msur_actl_perf_amt = 0>


</CFIF>

<CFLOOP Index=&quot;LoopCounter&quot;
From =&quot;1&quot; To=&quot;#FormrecCount#&quot;>


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

<CFTRANSACTION>
<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#, #ListGetAt(dlvr_id, LoopCounter)#, #ListGetAt(msur_id, LoopCounter)#, '#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(dlvr_id, LoopCounter)#
AND msur_id = #ListGetAt(msur_id, LoopCounter)#
AND perf_date = '#ListGetAt(perf_date, LoopCounter)#'
</CFQUERY>
</CFIF>

<CFSET Vmsur_freq = #msur_freq#>
<CFSET mth_pog = 0>
<CFSET ytd_pog = 0>
<CFSET ytd_perf = 0>

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


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

</CFTRANSACTION>
</CFLOOP>
<CFINCLUDE TEMPLATE=&quot;UpdateDetail.cfm&quot;>






Thanks for any help.
 
I'd recommend sticking the following in your application.cfm file:

<cfparam name=&quot;LoopCounter&quot; default=&quot;0&quot;>

That way, the variable is predefined and now if you get an error, hopefully it will help lead you to the problem. John Hoarty
jhoarty@quickestore.com
 
You're error is with the variable LoopCounter, where is the variable LoopCounter supposed to be comming from?

<CFIF ListContains(BypassMthCheck, LoopCounter, &quot;,&quot;) IS 0> - tleish
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top