Hey Everyone,
Well i am not sure if this is more of a coldfusion problem or a javscript problem. So if i asked my question in the wrong section let me know an all move it to the correct place.
what i am trying to display previously entered multiple fields. I am able to get my serial fields to display correctly, but i can not display my parts fields correctly.
Currently this is what it does
serial information 1
parts 1
parts 2
serial information 2
parts 1
parts 2
and what it needs to do
serial information 1
parts 1
serial information 2
parts 1
the problem is instead of the part going with the correct serial. it basically puts the information for both parts i added under both of the 2 serials I am also having trouble deleting fields an adding fields for the parts fields.
if someone could explain what i am doing wrong with the parts i would really appreciate it. I know it has to do with the count, just not sure what i am doing wrong
here is the javascript for serial and parts that allows me to add serials and parts
here is the html/coldfusion that displays what was previously entered for serials and parts.
Thank you in advance,
Rach
Oct 16 '08
482 27202
Ok so would this be right or does this need to be under the cfset or the cfquery for the serialinsetupdate?
No, that would be correct, though you'll need to change the condition to neq. You also need to pass the serial number too.
and here is what i had previously for the stored procedure. But just not sure how to do the part where you said delete from the serial table where the inputs match . are you meaning when serial and the ticket number match?
Yes, and the stored procedure looks right.
No, that would be correct, though you'll need to change the condition to neq. You also need to pass the serial number too.
Yes, and the stored procedure looks right.
Hey Acoder,
So is this all correct an ready to try? - <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 '#Form.pk_ticketID#',
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">
-
</cfquery>
-
<cfset currSerialNo = currSerialNo + 1>
-
</cfloop>
-
<cfif machineCount eq currSerialNo>
-
<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>
-
</CFLOOP>
-
</CFIF>
-
Thank you,
Rach
If it's test data, it's always ready to try ;)
You just need to swap ticket and serial numbers around for the query.
If it's test data, it's always ready to try ;)
You just need to swap ticket and serial numbers around for the query.
Hey Acoder,
I tried it an its wanting a end </cfif> to go with
<cfif machineCount eq currSerialNo> an i looked back at your example an i think i might of had one part wrong. so does this seem more correct? - <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>
-
</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]>
Thank you :),
Rach
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.
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? - <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
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.
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 -
<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
When you say it doesn't work, what happens? What did you test with?
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
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.
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.serialcount 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 - <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 - </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
I said:
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.
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. - <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
Yes, you could use a normal query.
You need a count: - SELECT count(*) as serialcount
and only the ticket as the criterion.
Yes, you could use a normal query.
You need a count: - SELECT count(*) as serialcount
and only the ticket as the criterion.
Hey Acoder,
So would this be correct? - <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
Two more things:
1. The loop should loop till countserials.serialcount.
2. You need to increment currSerialNum within this loop too.
Two more things:
1. The loop should loop till countserials.serialcount.
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_serial where pkb_fk_ticketNo=148,148"
Data Source = "CUSTOMERSUPPORT"
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\Development\WWWRoot\RachelB\footprints\ form\userformedit.cfm.
an the part its having trouble on is - <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
You'll have problems using pkb_ticket, use form.pk_ticketID instead inside a cfqueryparam.
You'll have problems using pkb_ticket, use form.pk_ticketID instead inside a cfqueryparam.
Hey Acoder,
Alrighty i replaced it with - <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 - <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
pkb_fk_ticketNo shouldn't have been replaced: - <cfquery name="countserials" datasource="CustomerSupport">
-
SELECT COUNT(*) as serialcount from dbo.tbl_CS_serial where pkb_fk_ticketNo=<cfqueryparam value="Form.pk_ticketID#">
-
</cfquery>
I notice that you have serialnum in both queries, but they're not set correctly. Set serialnum to the correct value in both loops.
pkb_fk_ticketNo shouldn't have been replaced: - <cfquery name="countserials" datasource="CustomerSupport">
-
SELECT COUNT(*) as serialcount from dbo.tbl_CS_serial where pkb_fk_ticketNo=<cfqueryparam value="Form.pk_ticketID#">
-
</cfquery>
I notice that you have serialnum in both queries, but they're not set correctly. Set serialnum to the correct value in both loops.
Hey Acoder,
Only part i am not understanding is the part about setting serialnum to the correct value? because in the javascript and html it has the name serialnum followed by the count - <input type="text" name="serialnum_#count#">
Thank you,
Rach
I meant in the submitted page, but now I see that the serial numbers to delete are not available anywhere. So you'll have to change the countserials query to list the serial numbers instead of counting - you'll get the count from the recordcount anyway. then use these serial numbers to delete.
I meant in the submitted page, but now I see that the serial numbers to delete are not available anywhere. So you'll have to change the countserials query to list the serial numbers instead of counting - you'll get the count from the recordcount anyway. then use these serial numbers to delete.
Hey Acoder,
Are you talking about something like this - <cfquery name="countserials" datasource="CustomerSupport">
-
SELECT COUNT(*) as pka_serialNo from dbo.tbl_CS_serial where pkb_fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#">
-
</cfquery>
an i am still confused about changing the value in the cfloop part - <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>
Thank you,
Rach
Not quite - you need the serials: - <cfquery name="countserials" datasource="CustomerSupport">
-
SELECT pka_serialNo from dbo.tbl_CS_serial where pkb_fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#">
-
</cfquery>
The #serialnum# variable has to be set to the correct serial number, so you need to get the serial number from this query. Are the serial numbers in the correct order - you may need to add an ORDER BY clause.
Not quite - you need the serials: - <cfquery name="countserials" datasource="CustomerSupport">
-
SELECT pka_serialNo from dbo.tbl_CS_serial where pkb_fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#">
-
</cfquery>
The #serialnum# variable has to be set to the correct serial number, so you need to get the serial number from this query. Are the serial numbers in the correct order - you may need to add an ORDER BY clause.
Hey Acoder,
Only part i am confused on is how to set the #serialnum# variable to the correct serial number? i was thinking something like this but i am pretty sure i am wrong - <cfquery name="countserials" datasource="CustomerSupport">
-
SELECT pka_serialNo from dbo.tbl_CS_serial where pka_serialNo=<cfqueryparam value="#serialnum#"> and pkb_fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#">
-
</cfquery>
an i am not sure if the serial numbers are in the correct order. In my sql table they are just scattered everywhere so theres no real order. An afraid if i put them in order that it will mess it up because the first serial could be serial 2 and the second serial could be 1 so kinda nervous about doing that.
Thank you,
Rach
The query was OK, I meant setting serialnum in the Coldfusion code in the loops.
The order wouldn't change the order in the database - it'd only change the order in which they are retrieved.
I have to say that this could get pretty complex now. Basically, you need to use these serial numbers to determine which ones need to be updated, which need to be deleted and which are new (from the new serial numbers). Now I'm not sure exactly which way would be the best or most efficient way- it depends on a number of factors. All of this could of course be avoided if you just stick with the delete all and then insert all approach, but you wanted to avoid that (we can always go back ;)).
The query was OK, I meant setting serialnum in the Coldfusion code in the loops.
The order wouldn't change the order in the database - it'd only change the order in which they are retrieved.
I have to say that this could get pretty complex now. Basically, you need to use these serial numbers to determine which ones need to be updated, which need to be deleted and which are new (from the new serial numbers). Now I'm not sure exactly which way would be the best or most efficient way- it depends on a number of factors. All of this could of course be avoided if you just stick with the delete all and then insert all approach, but you wanted to avoid that (we can always go back ;)).
Hey Acoder,
how would i set the serialnum in the coldfusion code in the loops? are you saying instead of using - <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
to use
An i know it will probably get more complicated but i think its the best way. Last few days we been running into internet trouble an well i am just afraid information will be lost if go back in the other direction.
Thank you :),
Rach
If that's the only reason, then that's what we have cftransaction for. It's either all or nothing. If it hasn't inserted that last record and something happens, then nothing is deleted or affected. Even with the current approach, you'd need cftransaction if you were fearing connection problems.
Anyway, for the serial number, see the cfset serialnum line. You need something similar in each loop which would set the serial number for use in the delete query. However, you can have one loop only by looping over this count query instead. The idea is that you'd first get a serial number. If it's not set from the submitted fields, then it needs to be deleted. If it's there, that means it needs to be updated. Some new ones may need to be inserted, so you'll need some way of determining what has been updated or deleted and the rest need to be inserted.
If that's the only reason, then that's what we have cftransaction for. It's either all or nothing. If it hasn't inserted that last record and something happens, then nothing is deleted or affected. Even with the current approach, you'd need cftransaction if you were fearing connection problems.
Anyway, for the serial number, see the cfset serialnum line. You need something similar in each loop which would set the serial number for use in the delete query. However, you can have one loop only by looping over this count query instead. The idea is that you'd first get a serial number. If it's not set from the submitted fields, then it needs to be deleted. If it's there, that means it needs to be updated. Some new ones may need to be inserted, so you'll need some way of determining what has been updated or deleted and the rest need to be inserted.
Hey Acoder,
Here is what i have in full.I set the serialnum but was not sure if you wanted to do the one loop only part. - <CFIF REQUEST_METHOD EQ "POST">
-
<!---<CFSET machineListLen = listLen(Form.serialcount)>--->
-
<cfquery name="countserials" datasource="CustomerSupport">
-
SELECT pka_serialNo from dbo.tbl_CS_serial where pkb_fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#">
-
</cfquery>
-
<cfset currSerialNo = 1>
-
<CFLOOP list="#form.serialcount#" index="machineCount">
-
<!--- <cfif machineCount eq currSerialNo>--->
-
<cfloop condition="currSerialNo neq machinecount">
-
<CFSET serialnum = Form["serialnum_" & 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.pka_serialNo">
-
<CFSET serialnum = Form["serialnum_" & 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>
-
</CFIF>
an i tried what i have above an i got an error with the last loop saying
Error resolving parameter SERIALNUM
ColdFusion was unable to determine the value of the parameter.
Thank you,
Rach
Yes, it's not going to work because it doesn't exist.
If you look at the second paragraph above, that's one possible way to solve this. For any to-be-deleted serials, you no longer have the serial numbers (in the submitted fields). They're only available in the query. So you're going to have to use the query to get the serial numbers. This will require quite a few changes, the main one being that instead of looping over the list, you'll loop over the query. Then deleting becomes easy, but inserting/updating becomes a bit more difficult.
Hey Acoder,
Ok so the loop would be done like so?an then for machineCount could we do something below the cfloop query like cfset machineCount = 1? - <CFIF REQUEST_METHOD EQ "POST">
-
<!---<CFSET machineListLen = listLen(Form.serialcount)>--->
-
<cfquery name="countserials" datasource="CustomerSupport">
-
SELECT pka_serialNo from dbo.tbl_CS_serial where pkb_fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#">
-
</cfquery>
-
<cfset currSerialNo = 1>
-
<cfloop query="#countserials#">
-
<!--- <cfif machineCount eq currSerialNo>--->
-
<cfloop condition="currSerialNo neq machinecount">
-
<CFSET serialnum = Form["serialnum_" & 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.pka_serialNo">
-
<CFSET serialnum = Form["serialnum_" & 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>
-
</CFIF>
Thank you,
Rach
I'm now thinking that since you want to avoid problems if something happens in between, it would be better to insert/update, then delete.
So, keep it as it was earlier with the serial counts looping, and then add a delete loop at the bottom. All you need to do is delete all the serials except the ones that have been updated or inserted, so you can use an array to store the serial numbers to match against. In the delete loop, check that the serial number is not in this insert-update array. If it isn't, delete the serial.
An even better way (but a lot more involved from where you're at currently) is to only insert, update or delete one serial or one part at a time. It would avoid all of these problems, but it would mean a lot of to-ing and fro-ing, but you can avoid that too if you use Ajax (but that's a different ball game altogether!).
Hey Acoder,
Alright i went back to cflooping but i was wondering where would the delete loop go? would it be the one i have at the way bottom already like so? -
</cfloop>
-
<cfset currSerialNo = currSerialNo + 1>
-
</CFLOOP>
-
<cfloop condition="currSerialNo neq countserials.pka_serialNo">
-
<CFSET serialnum = Form["serialnum_" & 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>
-
</CFIF>
an then how would i in the delete loop check that the serial number is not in the insert-update array? but i was messing around with arrays, was looking an example online an i was wondering if you were meaning to do something like the following? -
<CFIF REQUEST_METHOD EQ "POST">
-
<!---<CFSET machineListLen = listLen(Form.serialcount)>--->
-
<cfquery name="countserials" datasource="CustomerSupport">
-
SELECT pka_serialNo from dbo.tbl_CS_serial where pkb_fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#">
-
</cfquery>
-
<cfset currSerialNo = 1>
-
<CFLOOP list="#form.serialcount#" index="machineCount">
-
<!--- <cfif machineCount eq currSerialNo>--->
-
-
<cfloop condition="currSerialNo neq machinecount">
-
<CFSET serialnum = Form["serialnum_" & 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 test = ArrayNew(1)>
-
<CFSET ArrayAppend(test, "serialnum = Form["serialnum_" & machineCount]")>
-
<CFSET ArrayAppend(test,"modelno = Form["modelno_" & machineCount]")>
-
<CFSET producttype = Form["producttype_" & machineCount]>
-
<CFSET softhardware = Form["softhardware_" & machineCount]>
-
<CFSET resolution = Form["resolution_" & machineCount]>
Thank you,
Rach
Yes, the delete would go at the bottom.
You don't need the inner loop in the first one any more (line 10-18 in 2nd code block). Neither do you need currSerialNum anywhere.
For the array, you just need the actual serial number values, not "serialnum = ...".
Yes, the delete would go at the bottom.
You don't need the inner loop in the first one any more (line 10-18 in 2nd code block). Neither do you need currSerialNum anywhere.
For the array, you just need the actual serial number values, not "serialnum = ...".
Hey Acoder,
So for the delete what would i change the condition to because i have the following right now - <cfloop condition="currSerialNo neq countserials.pka_serialNo">
-
<CFSET serialnum = Form["serialnum_" & machineCount]>
-
<cfquery name="deleteserialparts" datasource="CustomerSupport">
-
exec usp_CS_Deleteserialparts
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.pk_ticketID#'
-
</cfquery>
-
</cfloop>
an so for the array for each one this would be ok? - <CFSET ArrayAppend(test, "Form["serialnum_" & machineCount]")>
Thank you,
Rach
Yes, there's no need for a condition any longer because you'll be looping over the query.
In the array, you need to wrap the form value in #s.
Yes, there's no need for a condition any longer because you'll be looping over the query.
In the array, you need to wrap the form value in #s.
Hey Acoder,
so would this be correct for the delete at the bottom? - <cfloop query="countserials">
-
<CFSET serialnum = Form["serialnum_" & machineCount]>
-
<cfquery name="deleteserialparts" datasource="CustomerSupport">
-
exec usp_CS_Deleteserialparts
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.pk_ticketID#'
-
</cfquery>
-
</cfloop>
and then for the array this correct? - <CFSET ArrayAppend(test, "#Form["serialnum_" & machineCount]#")>
Thank you,
Rach
The array should be correct. You can cfdump to make sure.
In the delete loop, set serialnum to the field name or you can use the serialNo field name itself. Then you need to compare against the contents of the array. Unfortunately, Coldfusion doesn't have an ArrayFind, but you could use a UDF from CFLib for example, or convert the array to a list and then use ListFind().
The array should be correct. You can cfdump to make sure.
In the delete loop, set serialnum to the field name or you can use the serialNo field name itself. Then you need to compare against the contents of the array. Unfortunately, Coldfusion doesn't have an ArrayFind, but you could use a UDF from CFLib for example, or convert the array to a list and then use ListFind().
Hey Acoder,
are you saying something like this for the delete loop? - <cfloop query="countserials">
-
<CFSET serialnum = #Form.serialnum#>
-
<cfquery name="deleteserialparts" datasource="CustomerSupport">
-
exec usp_CS_Deleteserialparts
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.pk_ticketID#'
-
</cfquery>
-
</cfloop>
an for the array would this convert it ? - <cfset test = ArrayNew(1)>
-
<CFSET ArrayAppend(test, "#Form["serialnum_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["modelno_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["producttype_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["softhardware_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["resolution_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["resdate_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["resvertified_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["vertifidate_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["deptvendor_" & machinecount]#")>
-
<CFSET ArrayAppend(test, "#Form["hardwarefailure_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["thedescription_" & machineCount]#")>
-
<cfset myList = ArrayToList(test, ",")>
-
<cfset anothert = ListFind(myList, form.serialnum)>
Thank you,
Rach
In the delete loop, the serial number should be the field from the query, not a form field.
In the array, you only need the serial numbers for comparison, not all the fields.
In the delete loop, the serial number should be the field from the query, not a form field.
In the array, you only need the serial numbers for comparison, not all the fields.
Hey Acoder,
so for the delete loop it should be like so - <cfloop query="countserials">
-
<CFSET serialnum = <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">>
-
<cfquery name="deleteserialparts" datasource="CustomerSupport">
-
exec usp_CS_Deleteserialparts
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.pk_ticketID#'
-
</cfquery>
an for the array i am confused are you meaning something like this - <cfset test = ArrayNew(1)>
-
<CFSET ArrayAppend(test, "#Form["serialnum_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["modelno_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["producttype_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["softhardware_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["resolution_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["resdate_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["resvertified_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["vertifidate_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["deptvendor_" & machinecount]#")>
-
<CFSET ArrayAppend(test, "#Form["hardwarefailure_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["thedescription_" & machineCount]#")>
-
<cfset myList = ArrayToList(test, ",")>
-
<cfset anothert = ListFind(form.serialnum)>
Thank you,
Rach
so for the delete loop it should be like so
Not quite. cfqueryparam is only required inside a cfquery tag. You only need the field name which would be pka_serialNo in this case.
an for the array i am confused are you meaning something like this
No. You only need the serial number, so only lines 1-2 and 13-14 - the rest of the lines are not needed because the array is only for comparison and the only value you're comparing against is the serial number.
Not quite. cfqueryparam is only required inside a cfquery tag. You only need the field name which would be pka_serialNo in this case.
No. You only need the serial number, so only lines 1-2 and 13-14 - the rest of the lines are not needed because the array is only for comparison and the only value you're comparing against is the serial number.
Hey Acoder,
Alrighty here is what i have for the delete - <cfloop query="countserials">
-
<CFSET serialnum = #pka_serialNo#>
-
<cfquery name="deleteserialparts" datasource="CustomerSupport">
-
exec usp_CS_Deleteserialparts
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.pk_ticketID#'
-
</cfquery>
-
</cfloop>
-
</CFIF>
and here is what i have for the first loop - <cfset test = ArrayNew(1)>
-
<CFSET ArrayAppend(test, "#Form["serialnum_" & machineCount]#")>
-
<cfset myList = ArrayToList(test, ",")>
-
<cfset anothert = ListFind(form.serialnum)>
but i was wondering what do i need to do with the rest of the fields, these ones because we had original had them an it was just cfset modelno = #Form["modelno_" * machineCount]#> - <CFSET ArrayAppend(test, "#Form["modelno_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["producttype_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["softhardware_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["resolution_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["resdate_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["resvertified_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["vertifidate_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["deptvendor_" & machinecount]#")>
-
<CFSET ArrayAppend(test, "#Form["hardwarefailure_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["thedescription_" & machineCount]#")>
Thank you,
Rach
The array is not meant to replace the cfset lines. Those lines have to stay and the array code is in addition to the previous code, not replace it because they are for different purposes.
The array is not meant to replace the cfset lines. Those lines have to stay and the array code is in addition to the previous code, not replace it because they are for different purposes.
Hey Acoder,
so our you saying to do it like below? -
<cfset test = ArrayNew(1)>
-
<CFSET ArrayAppend(test, "#Form["serialnum_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["modelno_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["producttype_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["softhardware_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["resolution_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["resdate_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["resvertified_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["vertifidate_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["deptvendor_" & machinecount]#")>
-
<CFSET ArrayAppend(test, "#Form["hardwarefailure_" & machineCount]#")>
-
<CFSET ArrayAppend(test, "#Form["thedescription_" & machineCount]#")>
-
<cfset myList = ArrayToList(test, ",")>
-
<cfset anothert = ListFind(form.serialnum)>
-
<cfset test = ArrayNew(1)>
-
<CFSET ArrayAppend(test, "#Form["serialnum_" & machineCount]#")>
-
<cfset myList = ArrayToList(test, ",")>
-
<cfset anothert = ListFind(form.serialnum)>
-
-
Thank you,
Rach
No, keep it as you had in, for example, post #282. These four array creation/setting lines only add the serial number. The array create line should be outside the loop. Only the array append line should be in the loop.
No, keep it as you had in, for example, post #282. These four array creation/setting lines only add the serial number. The array create line should be outside the loop. Only the array append line should be in the loop.
Hey Acoder,
Ok i am still a bit confused but are you talking about something like this?
here is what i got in full. - <CFIF REQUEST_METHOD EQ "POST">
-
-
<cfquery name="countserials" datasource="CustomerSupport">
-
SELECT pka_serialNo from dbo.tbl_CS_serial where pkb_fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#">
-
</cfquery>
-
<cfset currSerialNo = 1>
-
<CFLOOP list="#form.serialcount#" index="machineCount">
-
<CFSET serialnum = Form["serialnum_" & machineCount]>
-
<cfquery name="deleteserialparts" datasource="CustomerSupport">
-
exec usp_CS_Deleteserialparts
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.pk_ticketID#'
-
</cfquery>
-
<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]>
-
<cfset test = ArrayNew(1)>
-
<CFSET ArrayAppend(test, "#Form["serialnum_" & 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>
-
-
</CFLOOP>
-
<cfset myList = ArrayToList(test, ",")>
-
<cfset anothert = ListFind(form.serialnum)>
-
<cfloop query="countserials">
-
-
<CFSET serialnum = #pka_serialNo#>
-
<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
Remove the deleteserialparts query from the first loop. You can also remove line 8 because it's a repeat of line 14.
Line 25 should be above the loop because you don't want to create a new array for each serial.
Finally, line 79 should be inside the countserials loop for comparison though it'll need to be in a cfif tag to actually compare or you could use the variable for comparison.
Remove the deleteserialparts query from the first loop. You can also remove line 8 because it's a repeat of line 14.
Line 25 should be above the loop because you don't want to create a new array for each serial.
Finally, line 79 should be inside the countserials loop for comparison though it'll need to be in a cfif tag to actually compare or you could use the variable for comparison.
Hey Acoder,
Only part i am confused about is the cfif part, how would i make this into a cfif? - <cfset anothert = ListFind(form.serialnum)>
But here is what i have in full besides that - <CFIF REQUEST_METHOD EQ "POST">
-
-
<cfquery name="countserials" datasource="CustomerSupport">
-
SELECT pka_serialNo from dbo.tbl_CS_serial where pkb_fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#">
-
</cfquery>
-
<cfset currSerialNo = 1>
-
<cfset test = ArrayNew(1)>
-
<CFLOOP list="#form.serialcount#" index="machineCount">
-
<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]>
-
<CFSET ArrayAppend(test, "#Form["serialnum_" & 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 anothert = ListFind(form.serialnum)>
-
</CFLOOP>
-
-
-
<cfset myList = ArrayToList(test, ",")>
-
<cfloop query="countserials">
-
<CFSET serialnum = #pka_serialNo#>
-
<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
Sign in to post your reply or Sign up for a free account.
Similar topics
by: euang |
last post by:
Hi,
I have been using access 2000 for two years on WINDOWS NT to display dynamic
aweb page using ASP
My ISP has now changed to Windows 2003, and I am having major problems
displaying...
|
by: Sue |
last post by:
As soon as a character is entered in the first field of a new record, the number
of records shown in the navigation buttons increases by 1 and the new record
button becomes enabled. In the...
|
by: Robin S. |
last post by:
I tried to ask this question several days ago, but I didn't explain my
application correctly.
Basically I want to have one record from table "A" and I want to display,
say, 5 records from table...
|
by: Vigneshwar Pilli via DotNetMonster.com |
last post by:
Hey,
Well, I have a Problem.
I have designed a table which has few fields which are being declared in
the database of type ....
char of length 10.
and other fields with varchar 50 and...
|
by: hbomb |
last post by:
I have a form which is used to both enter data for an application and to view a snapshot of previous data entered for students. The database’s initial point of entry is a form called INTERESTED...
|
by: NumberCruncher |
last post by:
Hi All,
I am struggling with setting up my first system of tables, forms,and reports, and could use your help!
I am setting up a database to keep track of the production of a produced item. The...
|
by: banderson |
last post by:
Hello,
I have a combo box in which I want to display multiple fields by concatenating the fields together. If one of those concatenated fields is Null, then the combo box does not show anything. To...
|
by: bonneylake |
last post by:
Hey Everyone,
Well this is probably a pretty easy question, but for some reason i just can not figure it out.
What i am trying to do is redisplay what was entered previously. I have figured...
|
by: chuck gregory |
last post by:
I'm using the 2002 (10.6771.6845) SP3 Access program.
I have a form that will not show previously entered data. It has about 45 fields. I will call it the "parent" form. The "parent" form was at...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |