Need Help Updating 2 Tables from a Grid

Is there a way to do this in CF 9?

Some of the grid columns need to update the table "contract".
The update code for the other table, "fte" is below. It will
fail, obviously, since several columns in the update query
belong to the "contract" table.

Here's the relevant code:

GetRCPsForContracts.UpContract.cfc

  <cffunction name="UpContract" access="remote">  
        <cfargument name="gridaction" type="string" required="yes">
        <cfargument name="gridrow" type="struct" required="yes">
         <cfargument name="gridchanged" type="struct" required="yes">           
                

                <cfset var qUP  = "" />
                <!--- Get column name and value --->
                <cfset colname=StructKeyList(ARGUMENTS.gridchanged)>
                <cfset value=ARGUMENTS.gridchanged[colname]>
                          
                <!--- Perform update --->              
                   <cfquery name = "qUP" datasource="#request.ATCdsn#">
                UPDATE fte
                SET #colname# = '#value#'
                WHERE FTE_id = #ARGUMENTS.gridrow.FTE_id#
                </cfquery>               
</cffunction> 



ContractMngmnt.cfm

   <cfform  name="Contract_EDIT">

       <cfgrid name= "Contract_EDIT"
         title="Please update the following Contract/Task Information for your 
RCP" 
         selectmode="edit"      
         insert="no" 
         format="html"
         striperows="yes"
         bindonload="no" 
         bind="cfc:ATC._cfc.GetRCPsForContracts.ChosenContract({cfgridpage},
       {cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection}, 
{RCPContracts.CTR_ID}, {RCPContracts.FTE_id}, {RCPContracts.clin_id})"
  onChange="cfc:ATC._cfc.GetRCPsForContracts.UpContract({cfgridaction},
                                                        {cfgridrow},
                                                        {cfgridchanged}
                                                   )">
           <cfgridcolumn name="contract_number" header="Contract ##">           
                          
          <cfgridcolumn name="to_number" header="Task Order ##">
          <cfgridcolumn name="award_date" header="Award Date">
          <cfgridcolumn name="clin" header="CLIN" display="yes">
          <cfgridcolumn name="pop_start" header="POP Start">
          <cfgridcolumn name="pop_end" header="POP End">
          <cfgridcolumn name="price" header="Unit Price">
          <cfgridcolumn name="" header="Number of Units">
          <cfgridcolumn name="units_description" header="Unit Description">
          <cfgridcolumn name="total" header="Total Price">           
         </cfgrid>  
   </cfform> 

Thanks for any assistance you can provide. 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336016
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to