Create a summary of what has been updated on action page

armanbena
armanbena used Ask the Experts™
on
Hi,

I have passed data from a form to an action page.  I have a query which loops through and updates the database.  I would like to product a summary of what has been updated.  But I'm having trouble in doing it.  I can get the primary key, but am wondering how I would loop through and pull a different field in the list and display it. I thought I could create a list storing the values of what is being updated and all, but that didn't work, don't know if I did it wrong or if that can't be done.
<cfsilent>


</cfsilent>




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>OBI Status Check Tool</title>
	<link rel="stylesheet" type="text/css" href="css/structure.css">
	<link rel="stylesheet" type="text/css" href="css/form.css">

</head>

<cfparam name="url.start" default=1 />

<cfparam name="form.okay" default=1 /> 

<img src="images/trial1.jpg" align="CENTER" width="100%">
  <body id="public">
<cfset RecordCount = #form.totalRows#>
<cfset final = #form.id#>

<cfoutput>


<CFLOOP from = "1" to = "#final#" index = "i">  
   <cfif isdefined('FORM.GP#i#')>
         <cfset gpValue = FORM["gp"& i]>

            	<cfif   #val(gpValue)# eq 0>
        			<cfinclude template="rejected_email.cfm">
        		</cfif>
    <!---     <cfset TrackingNumber = FORM["TrackingNumber"& i]>--->


         <CFQUERY name="apprvd" DATASOURCE="Obi-default" result="test">  
            UPDATE      NF_WMI   
            SET            StatusFlag = #val(gpValue)#
            WHERE TrackingNumber = #i# <!---#val(TrackingNumber)#--->
        
     </CFQUERY>   
        
        
      
             
   </cfif> 
   
</CFLOOP> 
   
</cfoutput>
  

	<div id="container">
			<h1 id="logo">
 		 	</h1>
 
    <div align="center">
		<cfset name ="test" /> 
    </div>
    
    <div class="info" >
    	<h2 align="center" >Benefits Recorded</h2>
    </div>

    <div align="center">
     <div class="info">
 <br/> 
      
          <table width="57%"  align="center" >
  			 <tr>
             <td colspan="2"><div align="center"><b>The following ASC Mods have been recorded.</b></div></td>
             </tr>
  			 
             <tr>
  			   <td width="19%" height="57"><div align="right"><b>Approved:</b></div></td>
		       <td width="81%"></td>
		    </tr>
  			 <tr>
  			   <td height="54"><div align="right"><b>Disapproved:</b></div></td>
		       <td>&nbsp;</td>
		    </tr>
  			 <tr>
  			   <td colspan="2">&nbsp;</td>
		    </tr>
 		 </table>
         
         
      
      </div>
         </div>
         </div>
         </body>
         </html>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Did you want to just display the changes or save them in the database for a history of record updates?

How about something like this..

   <cfset compareColumns = "one,two,three"> <!---- a list of column names you want to test for change --->
 
  <!---- BEFORE UPDATE, fetch the original value from the database of these columns ---->
  <cfquery name="getOriginal" datasource="#request.datasource#">
      select #cols#
      from NF_WMI
      where TrackingNumber = #i#
    </cfquery>

    <!---- now compare the value and do something if they are different ----->
    <cfloop index="aCol" list="#compareColumns#">
       <cfif getOriginal[aCol][getOriginal.currentRow] is not form[aCol]>
          #aCol# changed from #getOriginal[aCol][getOriginal.currentRow]# to #form[aCol]#<br>
       </cfif>
    </cfloop>

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial