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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating Multiple Records

Status
Not open for further replies.

Katiris

Programmer
Feb 23, 2005
25
US
Can any of you lend a hand. I have a form that displays multiple records from one table and need to be able to update one or more record from that form. I have written the query to update the table. With one record it works fine. With two or more I bomb. I have a loop but it acts like it's not working. I have each field unique by tacking on the recordid to it. Everything I found on the subject which was not much said to do that plus use the evalutate function. Nothing seems to work!

<CFIF IsDefined("Form.action")>

<CFLOOP index="i" list="#FORM.sectionID#">



<cfif IsDefined("Form.LR_#sectionID#") is True>
<cfset "form.LR_#sectionID#" = "on">
<cfelse>
<cfset "form.LR_#sectionID#" = "off">
</cfif>
<cfif IsDefined("form.BPOC_#sectionID#") is True>
<cfset "form.BPOC_#sectionID#"= "on">
<cfelse>
<cfset "form.BPOC_#sectionID#" = "off">
</cfif>
<cfif IsDefined("form.LPOC_#sectionID#") is True>
<cfset "form.LPOC_#sectionID#"= "on">
<cfelse>
<cfset "form.LPOC_#sectionID#" = "off">
</cfif>
<cfif IsDefined("form.closingcheck_#sectionID#") is True>
<cfset "form.closingcheck_#sectionID#" = "on">
<cfelse>
<cfset "form.closingcheck_#sectionID#" = "off">
</cfif>

<cfset amount = #evaluate("Form.Amount_#sectionID#")#>
<cfset POCamount = #evaluate("Form.POCAmount_#sectionID#")#>


<cfoutput> <CFQUERY NAME="#i#" DATASOURCE="Accutrac">
UPDATE SECTION

set Lastmodifiedon = #Date#,
Description = '#evaluate("Form.Description_#sectionID#")#',
Percentagefield = '#evaluate("Form.Percent_#sectionID#")#',
Toname = '#evaluate("Form.Toname_#sectionID#")#',
LR = '#evaluate("Form.LR_#sectionID#")#',
POC = '#evaluate("Form.BPOC_#sectionID#")#',
LPOC = '#evaluate("Form.LPOC_#sectionID#")#',
Closingcheck = '#evaluate("Form.closingcheck_#sectionID#")#',
Amount = #NumberFormat(amount, "9999.99")#,
POCAmount = #NumberFormat(POCamount, "9999.99")#

where sectionID = #i#
</CFQUERY>


</cfoutput>
</CFLOOP>
</cfif>
 
all of your lines like
Code:
  <cfif IsDefined("Form.LR_#sectionID#") is True>
should use the index instead
Code:
  <cfif IsDefined("Form.LR_#i#") is True>

We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true.
 
Thank you very much, that narrowed it down. The only problem I'm having is with the amount fields. But after 3 days of hair pulling what a giant improvement


"Error","1016","07/11/05","14:01:07",,"10.1.1.17, Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322), <P>An error occurred while evaluating the expression: <P><PRE>#NumberFormat(amount, ""9999.99"")# </PRE></P></P>Error near line 126, column 14.<HR><P>Parameter 1 of function NumberFormat which is now ""3,213.00"" must be a number<P> <p>The error occurred while processing an element with a general identifier of (#NumberFormat(amount, ""9999.99"")#), occupying document position (126:13) to (126:45).</p><P><P>Date/Time: 07/11/05 14:01:07<BR>Browser: Mozilla/4.0 (compatible
 
Remove the double quotes from your number mask. ""9999.99"" should be "9999.99"



Hope This Helps!

ECAR
ECAR Technologies, LLC

"My work is a game, a very serious game." - M.C. Escher
 
That's not me that is the log file thats doing that.
 
Parameter 1 of function NumberFormat which is now ""3,213.00"" must be a number
remove the commas in the 'amount' value
Code:
NumberFormat(replace(amount, ",","","All"), "9999.99")

We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true.
 
Thank you once again. Your solutions have resolved all open issues.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top