displaying previously entered multiple fields

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bonneylake
    Contributor
    • Aug 2008
    • 769

    Originally posted by acoder
    Well, you don't need that cfif line at all, and you also need to add a currSerialNo increment line within the main loop, e.g. after parts on line 73.
    Hey Acoder,

    Ok so this should be correct?

    Code:
    <CFIF REQUEST_METHOD EQ "POST">
     <!---<CFSET machineListLen = listLen(Form.serialcount)>--->
     <cfset currSerialNo = 1>
     <CFLOOP list="#form.serialcount#" index="machineCount">
    
      <cfloop condition="currSerialNo neq machinecount">
     <cfquery name="deleteserialparts" datasource="CustomerSupport">
     exec usp_CS_Deleteserialparts   
     <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
     '#Form.pk_ticketID#'
     </cfquery>
    
     </cfloop>
     </cfif>
     <CFSET serialnum       = Form["serialnum_" & machineCount]>
      <CFSET modelno         = Form["modelno_" & machineCount]>
      <CFSET producttype     = Form["producttype_" & machineCount]>
     <CFSET softhardware    = Form["softhardware_" & machineCount]>
      <CFSET resolution      = Form["resolution_" & machineCount]>
      <CFSET resdate         = Form["resdate_" & machineCount]>
      <CFSET resvertified    = Form["resvertified_" & machineCount]>
    <CFSET vertifidate     = Form["vertifidate_" & machineCount]>
    <CFSET deptvendor      = Form["deptvendor_" & machinecount]>
     <CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
     <CFSET thedescription  = Form["thedescription_" & machineCount]>
     
    
     <!--- inserts information into the serial table--->
     <cfquery name="serialinsertupdate" datasource="CustomerSupport">
        exec usp_CS_Updateinsertserial 
         <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
         "#Form.pk_ticketID#",
         <cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
          <cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
         <cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
         <cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
         <cfqueryparam value="#resdate#">,
         <cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
         <cfqueryparam value="#vertifidate#">,
        <cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
         <cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">   
         </cfquery>
    
     <!---Inserts information into notes_descr table.--->
     <cfquery name="description" datasource="CustomerSupport">
        exec usp_CS_Insertdescription
       <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
       '#Form.pk_ticketID#',
        <cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
       '#Form.fk_addedBy#'
     </cfquery>
      
      <!---Inserts parts information into parts table.--->
      <!---because it is a bit we don't use 'ticks' around defective for parts table--->
     <cfparam name="form.partcounter#machinecount#" default="">
     <cfloop list="#form['partscount' & machinecount]#" index="ps">
    <cfparam name="Form.defective_#ps#_#machinecount#" default="0">
      <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0">
     <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
     <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
     <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
     <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
    <cfquery name="parts" datasource="CustomerSupport">
       exec usp_CS_Updateinsertparts 
      <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
       '#Form.pk_ticketID#',
        <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
        <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
        <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">,
       <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
    
     </cfquery> 
    
    </cfloop>
     <cfset currSerialNo = currSerialNo + 1>
    </CFLOOP>
     </CFIF>
    Thank you,
    Rach

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      Where did the currSerialNum increment line go - you need it in both places.

      You also have a stray ending </cfif > tag on line 14 that's not required.

      Comment

      • bonneylake
        Contributor
        • Aug 2008
        • 769

        Originally posted by acoder
        Where did the currSerialNum increment line go - you need it in both places.

        You also have a stray ending </cfif > tag on line 14 that's not required.
        Hey Acoder,

        Here is what i have in full, is this correct? i think i am still missing something because i tried it an it didn't work
        Code:
        <CFIF REQUEST_METHOD EQ "POST">
         <!---<CFSET machineListLen = listLen(Form.serialcount)>--->
         <cfset currSerialNo = 1>
         <CFLOOP list="#form.serialcount#" index="machineCount">
        <!--- <cfif machineCount eq currSerialNo>--->
          <cfloop condition="currSerialNo neq machinecount">
         <cfquery name="deleteserialparts" datasource="CustomerSupport">
         exec usp_CS_Deleteserialparts   
         <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
         '#Form.pk_ticketID#'
         </cfquery>
         <cfset currSerialNo = currSerialNo + 1>
         </cfloop>
        
         <CFSET serialnum       = Form["serialnum_" & machineCount]>
          <CFSET modelno         = Form["modelno_" & machineCount]>
          <CFSET producttype     = Form["producttype_" & machineCount]>
         <CFSET softhardware    = Form["softhardware_" & machineCount]>
          <CFSET resolution      = Form["resolution_" & machineCount]>
          <CFSET resdate         = Form["resdate_" & machineCount]>
          <CFSET resvertified    = Form["resvertified_" & machineCount]>
        <CFSET vertifidate     = Form["vertifidate_" & machineCount]>
        <CFSET deptvendor      = Form["deptvendor_" & machinecount]>
         <CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
         <CFSET thedescription  = Form["thedescription_" & machineCount]>
         
        
         <!--- inserts information into the serial table--->
         <cfquery name="serialinsertupdate" datasource="CustomerSupport">
            exec usp_CS_Updateinsertserial 
             <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
             "#Form.pk_ticketID#",
             <cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
              <cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
             <cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
             <cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
             <cfqueryparam value="#resdate#">,
             <cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
             <cfqueryparam value="#vertifidate#">,
            <cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
             <cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">   
             </cfquery>
        
         <!---Inserts information into notes_descr table.--->
         <cfquery name="description" datasource="CustomerSupport">
            exec usp_CS_Insertdescription
           <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
           '#Form.pk_ticketID#',
            <cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
           '#Form.fk_addedBy#'
         </cfquery>
          
          <!---Inserts parts information into parts table.--->
          <!---because it is a bit we don't use 'ticks' around defective for parts table--->
         <cfparam name="form.partcounter#machinecount#" default="">
         <cfloop list="#form['partscount' & machinecount]#" index="ps">
        <cfparam name="Form.defective_#ps#_#machinecount#" default="0">
          <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0">
         <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
         <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
         <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
         <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
        <cfquery name="parts" datasource="CustomerSupport">
           exec usp_CS_Updateinsertparts 
          <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
           '#Form.pk_ticketID#',
            <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
            <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
            <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">,
           <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
         </cfquery> 
        
        </cfloop>
         <cfset currSerialNo = currSerialNo + 1>
        </CFLOOP>
         </CFIF>
        Thank you,
        Rach

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          When you say it doesn't work, what happens? What did you test with?

          Comment

          • bonneylake
            Contributor
            • Aug 2008
            • 769

            Originally posted by acoder
            When you say it doesn't work, what happens? What did you test with?
            Hey Acoder,

            I tested with the previous code. An i had the following

            serial 1
            parts 1
            serial 2
            parts 2

            an i deleted serial 2 and parts 2 so when i submitted i had

            serial 1
            parts 1

            when i submitted i didn't get a single error. However, when i went back to see that serial 2 parts 2 should be gone it was still there.

            Thank you,
            Rach

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              Oh, I see why it didn't work in that scenario. The main cfloop loops till the serial count. Since the serial count would only be 1, it would ignore 2 completely. Now, if you'd had 1, 2 and 3 and deleted 2, then it would've worked.

              The way this inner loop works is that any missing serial counts in between are deleted. Since there could be a number of them, you have to use a loop until the number matches the current loop serial count number.

              To solve this particular conundrum, find out the number of serials for the ticket. This would be the number of serial counts in total. You have to make this query before any deletions. Then at the end of the main cfloop (outside it), delete the remaining serials in a loop similar to the inner one above. Loop from the last serial count+1 till the number of serials altogether.

              Comment

              • bonneylake
                Contributor
                • Aug 2008
                • 769

                Originally posted by acoder
                Oh, I see why it didn't work in that scenario. The main cfloop loops till the serial count. Since the serial count would only be 1, it would ignore 2 completely. Now, if you'd had 1, 2 and 3 and deleted 2, then it would've worked.

                The way this inner loop works is that any missing serial counts in between are deleted. Since there could be a number of them, you have to use a loop until the number matches the current loop serial count number.

                To solve this particular conundrum, find out the number of serials for the ticket. This would be the number of serial counts in total. You have to make this query before any deletions. Then at the end of the main cfloop (outside it), delete the remaining serials in a loop similar to the inner one above. Loop from the last serial count+1 till the number of serials altogether.
                Hey Acoder,

                kinda confused. Ok to find the number of serials for the ticket i would use form.serialcoun t correct? then i am not sure what you mean about making another query? an then at the very end your saying to make another cfloop, what type of cfloop? an then i would put the cfloop at the end but would i use the delete query i have now inside the last cfloop?

                here is what i tried but i think i am still off. still off on how to do the cfloop at the bottom an off on how to find out the number of serials.

                at the beginning i added the following

                Code:
                <CFIF REQUEST_METHOD EQ "POST">
                 <!---<CFSET machineListLen = listLen(Form.serialcount)>--->
                 <cfset sercount = #form.serialcount#>
                 <cfset currSerialNo = 1>
                 <CFLOOP list="#form.serialcount#" index="machineCount">
                and at the bottom i added this
                Code:
                </cfloop>
                 <cfset currSerialNo = currSerialNo + 1>
                </CFLOOP>
                 <cfloop list="#Form.serialcount#" index="ds">
                <cfquery name="deleteserialparts" datasource="CustomerSupport">
                exec usp_CS_Deleteserialparts   
                <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
                '#Form.pk_ticketID#'
                </cfquery>
                <cfset sercount = sercount + 1>
                </cfloop>
                 </CFIF>
                Thank you,
                Rach

                Comment

                • acoder
                  Recognized Expert MVP
                  • Nov 2006
                  • 16032

                  I said:
                  Originally posted by acoder
                  To solve this particular conundrum, find out the number of serials for the ticket. This would be the number of serial counts in total. You have to make this query before any deletions. Then at the end of the main cfloop (outside it), delete the remaining serials in a loop similar to the inner one above. Loop from the last serial count+1 till the number of serials altogether.
                  but there's a mistake there. It should be "This would be the number of serials in total." not 'serial counts'. So, you need a query which returns the number of serials for that ticket. You probably won't have this, so create one. For the loop, the condition is that you loop until currSerialNum eq this total number.

                  Comment

                  • bonneylake
                    Contributor
                    • Aug 2008
                    • 769

                    Originally posted by acoder
                    I said:but there's a mistake there. It should be "This would be the number of serials in total." not 'serial counts'. So, you need a query which returns the number of serials for that ticket. You probably won't have this, so create one. For the loop, the condition is that you loop until currSerialNum eq this total number.
                    Hey Acoder,

                    Is there a way i could do this without making another stored procedure? i would like to not have to do any more stored procedures then i already have but i am not sure how i would go about it i thought about doing something like below but i am not sure what else it would need to be able to accomplish counting.

                    Code:
                     <cfquery name="countserials" datasource="CustomerSupport">
                    SELECT *
                     FROM dbo.tbl_CS_serial
                     where pka_serialNo=#pka_serialNo# and pkb_fk_ticketNo = #pkb_fk_ticketNo#
                     </cfquery>
                    Thank you,
                    Rach

                    Comment

                    • acoder
                      Recognized Expert MVP
                      • Nov 2006
                      • 16032

                      Yes, you could use a normal query.

                      You need a count:
                      Code:
                      SELECT count(*) as serialcount
                      and only the ticket as the criterion.

                      Comment

                      • bonneylake
                        Contributor
                        • Aug 2008
                        • 769

                        Originally posted by acoder
                        Yes, you could use a normal query.

                        You need a count:
                        Code:
                        SELECT count(*) as serialcount
                        and only the ticket as the criterion.
                        Hey Acoder,

                        So would this be correct?

                        Code:
                        <CFIF REQUEST_METHOD EQ "POST">
                         <!---<CFSET machineListLen = listLen(Form.serialcount)>--->
                         <cfquery name="countserials" datasource="CustomerSupport">
                        SELECT COUNT(*) as serialcount from dbo.tbl_CS_serial where pkb_fk_ticketNo=#pkb_fk_ticketNo#
                         </cfquery>
                         <cfset currSerialNo = 1>
                         <CFLOOP list="#form.serialcount#" index="machineCount">
                        <!--- <cfif machineCount eq currSerialNo>--->
                          <cfloop condition="currSerialNo neq machinecount">
                         <cfquery name="deleteserialparts" datasource="CustomerSupport">
                         exec usp_CS_Deleteserialparts   
                         <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
                         '#Form.pk_ticketID#'
                         </cfquery>
                         <cfset currSerialNo = currSerialNo + 1>
                         </cfloop>
                        
                          <CFSET serialnum       = Form["serialnum_" & machineCount]>
                          <CFSET modelno         = Form["modelno_" & machineCount]>
                          <CFSET producttype     = Form["producttype_" & machineCount]>
                          <CFSET softhardware    = Form["softhardware_" & machineCount]>
                          <CFSET resolution      = Form["resolution_" & machineCount]>
                          <CFSET resdate         = Form["resdate_" & machineCount]>
                          <CFSET resvertified    = Form["resvertified_" & machineCount]>
                          <CFSET vertifidate     = Form["vertifidate_" & machineCount]>
                          <CFSET deptvendor      = Form["deptvendor_" & machinecount]>
                          <CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
                          <CFSET thedescription  = Form["thedescription_" & machineCount]>
                         
                        
                         <!--- inserts information into the serial table--->
                         <cfquery name="serialinsertupdate" datasource="CustomerSupport">
                            exec usp_CS_Updateinsertserial 
                             <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
                             "#Form.pk_ticketID#",
                             <cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
                              <cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
                             <cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
                             <cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
                             <cfqueryparam value="#resdate#">,
                             <cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
                             <cfqueryparam value="#vertifidate#">,
                            <cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
                             <cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">   
                             </cfquery>
                        
                         <!---Inserts information into notes_descr table.--->
                         <cfquery name="description" datasource="CustomerSupport">
                            exec usp_CS_Insertdescription
                           <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
                           '#Form.pk_ticketID#',
                            <cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
                           '#Form.fk_addedBy#'
                         </cfquery>
                          
                          <!---Inserts parts information into parts table.--->
                          <!---because it is a bit we don't use 'ticks' around defective for parts table--->
                         <cfparam name="form.partscount#machinecount#" default="">
                         <cfloop list="#form['partscount' & machinecount]#" index="ps">
                        <cfparam name="Form.defective_#ps#_#machinecount#" default="0">
                          <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0">
                         <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
                         <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
                         <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
                         <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
                        <cfquery name="parts" datasource="CustomerSupport">
                           exec usp_CS_Updateinsertparts 
                          <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
                           '#Form.pk_ticketID#',
                            <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
                            <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
                            <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">,
                           <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
                         </cfquery> 
                        </cfloop>
                         <cfset currSerialNo = currSerialNo + 1>
                        </CFLOOP>
                         <cfloop condition="currSerialNo neq countserials">
                        <cfquery name="deleteserialparts" datasource="CustomerSupport">
                        exec usp_CS_Deleteserialparts   
                        <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
                        '#Form.pk_ticketID#'
                        </cfquery>
                        
                        </cfloop>
                         </CFIF>
                        Thank you,
                        Rach

                        Comment

                        • acoder
                          Recognized Expert MVP
                          • Nov 2006
                          • 16032

                          Two more things:
                          1. The loop should loop till countserials.se rialcount.
                          2. You need to increment currSerialNum within this loop too.

                          Comment

                          • bonneylake
                            Contributor
                            • Aug 2008
                            • 769

                            Originally posted by acoder
                            Two more things:
                            1. The loop should loop till countserials.se rialcount.
                            2. You need to increment currSerialNum within this loop too.
                            Hey Acoder,

                            Alright i did what you said an went to try it out an i got the following error

                            Error Diagnostic Information
                            ODBC Error Code = 37000 (Syntax error or access violation)


                            [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near ','.


                            SQL = "SELECT COUNT(*) as serialcount from dbo.tbl_CS_seri al where pkb_fk_ticketNo =148,148"

                            Data Source = "CUSTOMERSUPPOR T"


                            The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (52:2) to (52:59) in the template file C:\Inetpub\Deve lopment\WWWRoot \RachelB\footpr ints\form\userf ormedit.cfm.


                            an the part its having trouble on is

                            Code:
                             <cfquery name="countserials" datasource="CustomerSupport">
                            SELECT COUNT(*) as serialcount from dbo.tbl_CS_serial where pkb_fk_ticketNo=#pkb_fk_ticketNo#
                             </cfquery>
                            any ideas?

                            Thank you :),
                            Rach

                            Comment

                            • acoder
                              Recognized Expert MVP
                              • Nov 2006
                              • 16032

                              You'll have problems using pkb_ticket, use form.pk_ticketI D instead inside a cfqueryparam.

                              Comment

                              • bonneylake
                                Contributor
                                • Aug 2008
                                • 769

                                Originally posted by acoder
                                You'll have problems using pkb_ticket, use form.pk_ticketI D instead inside a cfqueryparam.
                                Hey Acoder,

                                Alrighty i replaced it with

                                Code:
                                 <cfquery name="countserials" datasource="CustomerSupport">
                                SELECT COUNT(*) as serialcount from dbo.tbl_CS_serial where #Form.pk_ticketID#=#Form.pk_ticketID#
                                 </cfquery>
                                and i have noticed 2 problems. the first problem is i can not delete serial1 because it gives me an error saying no value for serialnum. an its got to be able to delete any serial.

                                an the second problem. i did a test an this is what i had before i submitted

                                first serial
                                serial 1
                                part 1

                                second serial
                                serial 2
                                part 2

                                i deleted the second serial and submitted. An this is what happened. Instead of the results for the first serial appearing (when i went back to look at it) It instead deleted the first serial (and part) an when it redisplayed it displayed the second serial's results.

                                This is what i have in full

                                Code:
                                <CFIF REQUEST_METHOD EQ "POST">
                                 <!---<CFSET machineListLen = listLen(Form.serialcount)>--->
                                 <cfquery name="countserials" datasource="CustomerSupport">
                                SELECT COUNT(*) as serialcount from dbo.tbl_CS_serial where #Form.pk_ticketID#=#Form.pk_ticketID#
                                 </cfquery>
                                
                                
                                 <cfset currSerialNo = 1>
                                 <CFLOOP list="#form.serialcount#" index="machineCount">
                                <!--- <cfif machineCount eq currSerialNo>--->
                                  <cfloop condition="currSerialNo neq machinecount">
                                 <cfquery name="deleteserialparts" datasource="CustomerSupport">
                                 exec usp_CS_Deleteserialparts   
                                 <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
                                 '#Form.pk_ticketID#'
                                 </cfquery>
                                 <cfset currSerialNo = currSerialNo + 1>
                                 </cfloop>
                                
                                  <CFSET serialnum       = Form["serialnum_" & machineCount]>
                                  <CFSET modelno         = Form["modelno_" & machineCount]>
                                  <CFSET producttype     = Form["producttype_" & machineCount]>
                                  <CFSET softhardware    = Form["softhardware_" & machineCount]>
                                  <CFSET resolution      = Form["resolution_" & machineCount]>
                                  <CFSET resdate         = Form["resdate_" & machineCount]>
                                  <CFSET resvertified    = Form["resvertified_" & machineCount]>
                                  <CFSET vertifidate     = Form["vertifidate_" & machineCount]>
                                  <CFSET deptvendor      = Form["deptvendor_" & machinecount]>
                                  <CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
                                  <CFSET thedescription  = Form["thedescription_" & machineCount]>
                                 
                                
                                 <!--- inserts information into the serial table--->
                                 <cfquery name="serialinsertupdate" datasource="CustomerSupport">
                                    exec usp_CS_Updateinsertserial 
                                     <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
                                     "#Form.pk_ticketID#",
                                     <cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
                                      <cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
                                     <cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
                                     <cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
                                     <cfqueryparam value="#resdate#">,
                                     <cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
                                     <cfqueryparam value="#vertifidate#">,
                                    <cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
                                     <cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">   
                                     </cfquery>
                                
                                 <!---Inserts information into notes_descr table.--->
                                 <cfquery name="description" datasource="CustomerSupport">
                                    exec usp_CS_Insertdescription
                                   <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
                                   '#Form.pk_ticketID#',
                                    <cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
                                   '#Form.fk_addedBy#'
                                 </cfquery>
                                  
                                  <!---Inserts parts information into parts table.--->
                                  <!---because it is a bit we don't use 'ticks' around defective for parts table--->
                                 <cfparam name="form.partscount#machinecount#" default="">
                                 <cfloop list="#form['partscount' & machinecount]#" index="ps">
                                <cfparam name="Form.defective_#ps#_#machinecount#" default="0">
                                  <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0">
                                 <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
                                 <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
                                 <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
                                 <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
                                <cfquery name="parts" datasource="CustomerSupport">
                                   exec usp_CS_Updateinsertparts 
                                  <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
                                   '#Form.pk_ticketID#',
                                    <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
                                    <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
                                    <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">,
                                   <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
                                 </cfquery> 
                                </cfloop>
                                 <cfset currSerialNo = currSerialNo + 1>
                                </CFLOOP>
                                 <cfloop condition="currSerialNo neq countserials.serialcount">
                                <cfquery name="deleteserialparts" datasource="CustomerSupport">
                                exec usp_CS_Deleteserialparts   
                                <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
                                '#Form.pk_ticketID#'
                                </cfquery>
                                 <cfset currSerialNo = currSerialNo + 1>
                                </cfloop>
                                 </CFIF>
                                Thank you,
                                Rach

                                Comment

                                Working...