update multiple fields within multiple records
Hi All,
I'm trying to edit this piece of code to allow me to edit more than just one field within a multi-record update. However, when I add a second field to the SET, I get this error:
"Invalid list index 5. In function ListGetAt(list, index [, delimiters]), the
value of index, 5, is not a valid as the first argument (this list has 4
elements). Valid indexes are in the range 1 through the number of elements in
the list.
The error occurred on line 120." (Line 120 is BESFollowUpStatus)
<CFSET Form.totRecords = Val(Form.totRecords) >
<CFOUTPUT >
<cfloop from="1" to="#form.totRecords#" index="ct">
<cfquery name="Recordset2_UPDATE" datasource="Incident_Reporting">
UPDATE dbo.tbl_P1
SET
AllDocumentsAttached = '#listgetat(form.AllDocumentsAttached,ct)#',
BESFollowUpStatus = '#listgetat(form.BESFollowUpStatus,ct)#'
WHERE
ID = #listgetat(form.ID,ct)#
</cfquery>
</cfloop>
<!---***************Ends : Multiple Active Reocrds************************--->
</CFOUTPUT>
Can you help me understand the error in the logic or if I am just going about this all wrong?
Thanks,
John
