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!

Passing form variables incorrectly. 1

Status
Not open for further replies.

CFDev

Programmer
Joined
Aug 24, 2001
Messages
8
Location
US
I'm passing a date from SelectPerfDate.cfm via drill down box as follows:

<SELECT NAME=&quot;dateSelected&quot; SIZE=&quot;3&quot;>
<CFOUTPUT QUERY=&quot;GetMonth&quot;>
<CFSET choice = #mth_name# & #year#>
<OPTION VALUE=&quot;#trim(mth_name)# #trim(year)#&quot;>#mth_name# #year#   
</CFOUTPUT>
</SELECT>

TO an UpdateDetail.cfm form page (parsing the date info from the above template) as follows:
<CFSET parsedPerfDate = ParseDateTime(dateSelected)>
<CFSET ODBCSelectedDate = CreateODBCDateTime(parsedPerfDate)>

UpdateDetail.cfm records must be updated or bypassed and posted to the UpdatePerf.cfm action page as follows:
<input type=&quot;checkbox&quot; name=&quot;BypassMthCheck&quot; VALUE=&quot;#RowIndex#&quot; CHECKED></FONT></TD>
<CFELSE>
<input type=&quot;checkbox&quot; name=&quot;BypassMthCheck&quot; VALUE=&quot;#RowIndex#&quot;></FONT></TD>
</CFIF>
<INPUT TYPE=&quot;text&quot; NAME=&quot;actl_perf_amt&quot; SIZE=&quot;10&quot; MAXLENGTH=&quot;10&quot; VALUE=&quot;#trim(NumberFormat(perfArray[RowIndex][2],&quot;999,999,999.00__&quot;))#&quot;></FONT></TD>

UpdatePerf.cfm Action Page code is as follows:
<CFTRANSACTION>
<CFLOOP Index=&quot;ListRead&quot; From =&quot;1&quot; To=&quot;#FormrecCount#&quot;>

<CFIF NOT parameterExists (BypassMthCheck)>
<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;) IS 0>

<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 mth_pog = 0>
<CFSET ytd_pog = 0>
<CFSET ytd_perf = 0>
<CFSET actl_perf_amt = #VAL(msur_actl_perf_amt)#>
<CFSET msur_freq = ListGetAt(form.msur_freq, ListRead, &quot;,&quot;)>
<CFSET msur_fmla_oper = ListGetAt(form.msur_fmla_oper, ListRead, &quot;,&quot;)>
<CFSET expc_perf_amt = ListGetAt(form.expc_perf_amt, ListRead, &quot;,&quot;)>
<CFSET msur_id = ListGetAt(form.msur_id, ListRead, &quot;,&quot;)>
<CFSET dlvr_id = ListGetAt(form.dlvr_id, ListRead, &quot;,&quot;)>
<CFSET Vmsur_freq = ListGetAt(form.msur_freq, ListRead, &quot;,&quot;)>
<CFSET perf_date = #ParseDateTime(ODBCSelectedDate)#>
<CFSET ODBCSelectedDate = #ParseDateTime(perf_date)#>


<!-- 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;>


I'm getting the following error message which appears the date is not parsing correctly. Also, note the column of &quot;N&quot;'s .....the values should be passed as N,Y,N,N,Y,N,Y,Y,Y --- What, in the code, is causing that to happen? Any held would be greatly appreciated. I'm at the drop-kicking point with this!!!!! :)
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
{ts '2001-08-01 00:00:00'} 25.3333,0.0000,22.00,59.00,0.0000,98.00,0.0000,0.0000,0.0000 617,617,617,617,617,618,618,618,618 1610,1611,1612,1613,1614,1615,1616,1617,1618 N,N,N,N,N,N,N,N,N






--------------------------------------------------------------------------------

Error Occurred While Processing Request
Error Diagnostic Information
ODBC Error Code = 37000 (Syntax error or access violation)


[Microsoft][ODBC SQL Server Driver][SQL Server]Line 6: Incorrect syntax near '2001'.


SQL = &quot;UPDATE Performance SET actl_perf_amt = '25.3333', ignore_month = 'N' WHERE dlvr_id = 617 AND msur_id = 1610 AND perf_date = '{ts '2001-08-01 00:00:00'}'&quot;




 
<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>

Try removing the single ticks around #perf_date# in the above query.



John Hoarty
jhoarty@quickestore.com
 
Thank you, thank you, thank you John. Worked like a charm!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top