Hey Everyone,
i been working on trying to understand the URL method of retrieving information for the last week, but i am stuck. I been able to get one table of information, but now i need to get 3 tables of information at the same time an i am running into trouble. Each table has a number in common with the other, each has a field that holds the number (but fields have different name). For example ticketMaster table has the field pk_ticketID which holds the number 1, serial has the field pkb_fk_ticketNo which holds the number 1, and parts has the field fk_ticketNo which holds the number 1. Right now i can get the correct table information for ticketMaster but for the serial an parts i get all the records that are in those tables instead of just the one record needed, which in this case is the one record that holds the number 1.
Right now here is what i have -
<!---Shows what was previously entered into table ticketmaster--->
-
<cfquery name="ticket" datasource="CustomerSupport">
-
SELECT pk_ticketID,title,priority,status,
-
cost_center,fk_customer_number,
-
customer_company,customer_Fname,customer_Lname,
-
customer_add1,customer_city,customer_state,
-
customer_zip,customer_email,customer_pri_phone,
-
customer_sec_phone,customer_notes,htpp FROM dbo.tbl_CS_ticketMaster
-
WHERE pk_ticketID = #URL.pk_ticketID#
-
</cfquery>
-
-
<cfquery name="serial" datasource="CustomerSupport">
-
SELECT pka_serialNo,pkb_fk_ticketNo,model_no,product_type ,
-
software_hardware,resolution,resolution_date,
-
verification_date,rma_data,
-
type_hardware_failure,dept_responsibility,resoluti on_verified_by FROM dbo.tbl_CS_serial
-
</cfquery>
-
-
<cfquery name="parts" datasource="CustomerSupport">
-
SELECT pk_partID,fk_serialNo,fk_ticketNo,hc_partNo,
-
part_returned,defective,submission
-
FROM dbo.tbl_CS_parts
-
</cfquery>
-
-
<form name="page1" id="page1" action="saveticket1edit.cfm?<cfoutput query="ticket">pk_ticketID=#pk_ticketID#</cfoutput><cfoutput query="serial">&pkb_fk_ticketNo=#pkb_fk_ticketNo#</cfoutput><cfoutput query="parts">&fk_ticketNo=#fk_ticketNo#</cfoutput>"
-
method="POST" onSubmit="return validate_form();">
-
</form>
if anyone could explain to me how to get the url method to work with 3 fields in 3 different tables i would really appreciate it.
Thank you in advance,
Rach
107 8498
You could combine all three into one query and perform a join operation. The best way would depend on the database and the dialect of SQL used, but a very simple way would be something like: - select ...
-
from ticket, serial, parts
-
where serial.fk_id = ticket.id and parts.fk_id = ticket.id
-
and ticket.id = #url...#
You match the foreign keys with the primary key of the main table to avoid duplicates.
You could combine all three into one query and perform a join operation. The best way would depend on the database and the dialect of SQL used, but a very simple way would be something like: - select ...
-
from ticket, serial, parts
-
where serial.fk_id = ticket.id and parts.fk_id = ticket.id
-
and ticket.id = #url...#
You match the foreign keys with the primary key of the main table to avoid duplicates.
Hey Acoder,
Well here is what i have, but its still not getting the right information, it still getting all the rows in the tables for serial and parts - <!---Shows what was previously entered into table ticketmaster--->
-
<cfquery name="ticket" datasource="CustomerSupport">
-
SELECT pk_ticketID,title,priority,status,cost_center,fk_customer_number,
-
customer_company,customer_Fname,customer_Lname,customer_add1
-
,customer_city,customer_state,
-
customer_zip,customer_email,customer_pri_phone,
-
customer_sec_phone,customer_notes,htpp FROM dbo.tbl_CS_ticketMaster
-
WHERE pk_ticketID = #URL.pk_ticketID#
-
</cfquery>
-
-
<cfquery name="serial" datasource="CustomerSupport">
-
SELECT pka_serialNo,pkb_fk_ticketNo,model_no,product_type,software_hardware,
-
resolution,resolution_date,
-
verification_date,rma_data,type_hardware_failure,dept_responsibility,
-
resolution_verified_by FROM dbo.tbl_CS_serial
-
-
</cfquery>
-
-
<cfquery name="parts" datasource="CustomerSupport">
-
SELECT pk_partID,fk_serialNo,fk_ticketNo,hc_partNo,part_returned,defective,submission
-
FROM dbo.tbl_CS_parts
-
</cfquery>
-
-
-
<cfquery name="all" datasource="CustomerSupport">
-
SELECT *
-
FROM dbo.tbl_CS_ticketMaster,dbo.tbl_CS_serial,dbo.tbl_CS_parts
-
WHERE pkb_fk_ticketNo = pk_ticketID and pk_partID = pk_ticketID
-
and pk_ticketID = #URL.pk_ticketID#
-
</cfquery>
-
-
<cfoutput query="all">
-
<form name="page1" id="page1" action="saveticket1edit.cfm?pk_ticketID=#pk_ticketID#"
-
method="POST" onSubmit="return validate_form();">
-
</cfoutput>
-
</form>
-
-
-
Thank you,
Rach
What's the relationship between serial/parts and ticket. Is it many-to-one, i.e. many serials and parts to one ticket?
What's the relationship between serial/parts and ticket. Is it many-to-one, i.e. many serials and parts to one ticket?
Ok everytime someone inserts a ticket. ticket has one record (always), parts has one record (always) and serial can have multiple records. An there all suppose to share the same ticket like pkb_fk_ticketNo (for serial) has the same number as fk_serialNo (for parts) and pk_ticketID(for ticket). Hope that makes since, kinda hard to explain.
Thank you,
Rach
Hey Acoder,
Yes its many serials and parts to one ticket. They all share the same number in each table like if pk_ticketID (from ticket table) has the number 1, then pkb_fk_ticketNo (from serial table) has the number 1, and fk_ticketNo(from parts table) has the number 1. I figured out i had the wrong field for parts. But even changing it didn't seem to help. But here is the statement again -
<cfquery name="all" datasource="CustomerSupport">
-
SELECT *
-
FROM dbo.tbl_CS_ticketMaster,dbo.tbl_CS_serial,dbo.tbl_CS_parts
-
-
WHERE pkb_fk_ticketNo = pk_ticketID and fk_ticketNo = pk_ticketID
-
and pk_ticketID = #URL.pk_ticketID#
-
</cfquery>
-
Thank you again for all your help,
Rach
To make things easier, you could use 3 queries as you had earlier.
As an example: - <cfquery name="serial" datasource="CustomerSupport">
-
SELECT pka_serialNo,pkb_fk_ticketNo,model_no,product_type ,
-
software_hardware,resolution,resolution_date,
-
verification_date,rma_data,
-
type_hardware_failure,dept_responsibility,resoluti on_verified_by FROM dbo.tbl_CS_serial
-
WHERE pkb_fk_ticketno = #url.pk_ticketID#
-
</cfquery>
Then you can get the serial and parts data separately.
To make things easier, you could use 3 queries as you had earlier.
As an example: - <cfquery name="serial" datasource="CustomerSupport">
-
SELECT pka_serialNo,pkb_fk_ticketNo,model_no,product_type ,
-
software_hardware,resolution,resolution_date,
-
verification_date,rma_data,
-
type_hardware_failure,dept_responsibility,resoluti on_verified_by FROM dbo.tbl_CS_serial
-
WHERE pkb_fk_ticketno = #url.pk_ticketID#
-
</cfquery>
Then you can get the serial and parts data separately.
Hey Acoder,
Thought i understood what you meant, but i am still having trouble.It still wont only get the serial and part associated with the ticket Here is what i have. - <cfquery name="ticket" datasource="CustomerSupport">
-
SELECT pk_ticketID,title,priority,status,cost_center,fk_customer_number,
-
customer_company,customer_Fname,customer_Lname,customer_add1,
-
customer_city,customer_state,
-
customer_zip,customer_email,customer_pri_phone,customer_sec_phone,
-
customer_notes,htpp FROM dbo.tbl_CS_ticketMaster
-
WHERE pk_ticketID = #URL.pk_ticketID#
-
</cfquery>
-
-
<cfquery name="serial" datasource="CustomerSupport">
-
SELECT pka_serialNo,pkb_fk_ticketNo,model_no,product_type,software_hardware
-
,resolution,resolution_date,
-
verification_date,rma_data,type_hardware_failure,dept_responsibility
-
,resolution_verified_by FROM dbo.tbl_CS_serial
-
WHERE pkb_fk_ticketNo = #URL.pk_ticketID#
-
</cfquery>
-
-
<cfquery name="parts" datasource="CustomerSupport">
-
SELECT pk_partID,fk_serialNo,fk_ticketNo,hc_partNo,part_returned,defective
-
,submission
-
FROM dbo.tbl_CS_parts
-
WHERE fk_ticketNo = #URL.pk_ticketID#
-
</cfquery>
-
-
<cfoutput>
-
<form name="page1" id="page1" action="saveticket1edit.cfm?pk_ticketID=#pk_ticketID#"
-
method="POST" onSubmit="return validate_form();">
-
</cfoutput>
Any suggestions?
Thank you for all the help :),
Rach
Where's the code for outputting the data?
Where's the code for outputting the data?
Hey Acoder,
Not sure what you mean, bit confused. i don't know if this is what you mean but here is all i have
page 1 - <!---Shows what was previously entered into table ticketmaster--->
-
<cfquery name="ticket" datasource="CustomerSupport">
-
SELECT pk_ticketID,title,priority,status,cost_center,fk_customer_number,
-
customer_company,customer_Fname,customer_Lname,customer_add1,customer_city,customer_state,
-
customer_zip,customer_email,customer_pri_phone,customer_sec_phone,customer_notes,htpp FROM dbo.tbl_CS_ticketMaster
-
WHERE pk_ticketID = #URL.pk_ticketID#
-
</cfquery>
-
-
<cfquery name="serial" datasource="CustomerSupport">
-
SELECT pka_serialNo,pkb_fk_ticketNo,model_no,product_type,software_hardware,resolution,resolution_date,
-
verification_date,rma_data,type_hardware_failure,dept_responsibility,resolution_verified_by FROM dbo.tbl_CS_serial
-
WHERE pkb_fk_ticketNo = #URL.pk_ticketID#
-
</cfquery>
-
-
<cfquery name="parts" datasource="CustomerSupport">
-
SELECT pk_partID,fk_serialNo,fk_ticketNo,hc_partNo,part_returned,defective,submission
-
FROM dbo.tbl_CS_parts
-
WHERE fk_ticketNo = #URL.pk_ticketID#
-
</cfquery>
-
-
<cfoutput>
-
<form name="page1" id="page1" action="saveticket1edit.cfm?pk_ticketID=#pk_ticketID#"
-
method="POST" onSubmit="return validate_form();">
-
</cfoutput>
an heres whats on page 2 - <cfquery name="ticket" datasource="CustomerSupport">
-
SELECT pk_ticketID,title,priority,status,cost_center,followup_date,fk_customer_number,
-
customer_company,customer_Fname,customer_Lname,customer_add1,customer_city,customer_state,
-
customer_zip,customer_email,customer_pri_phone,customer_sec_phone,customer_notes,onsite_flag,number_onsite,htpp FROM dbo.tbl_CS_ticketMaster
-
WHERE pk_ticketID = #URL.pk_ticketID#
-
</cfquery>
-
-
<cfquery name="serial" datasource="CustomerSupport">
-
SELECT pka_serialNo,pkb_fk_ticketNo,model_no,product_type,software_hardware,resolution,resolution_date,
-
verification_date,rma_data,type_hardware_failure,dept_responsibility,resolution_verified_by FROM dbo.tbl_CS_serial
-
</cfquery>
-
-
<cfquery name="parts" datasource="CustomerSupport">
-
SELECT pk_partID,fk_serialNo,fk_ticketNo,hc_partNo,part_returned,defective,submission
-
FROM dbo.tbl_CS_parts
-
-
-
</cfquery>
Thank you,
Rach
You mentioned in the first post that you're able to get one table of information, but not three. When you get the table data using cfquery, you must be using it somewhere, e.g. cfoutput, cfloop to display it or otherwise make use of it. Also, what's the purpose of that form?
You mentioned in the first post that you're able to get one table of information, but not three. When you get the table data using cfquery, you must be using it somewhere, e.g. cfoutput, cfloop to display it or otherwise make use of it. Also, what's the purpose of that form?
Hey Acoder,
Ok here is how i do it.
On the index.cfm page i have this. - <cfquery name="ticket" datasource="CustomerSupport">
-
SELECT pk_ticketID,status,title,date_last_modified,date_submitted,
-
customer_company FROM dbo.tbl_CS_ticketMaster
-
</cfquery>
-
-
<cfoutput query="ticket">
-
<a href="form/cticketpage1edit.cfm?pk_ticketID=#pk_ticketID#" target="_blank">#pk_ticketID#</a>
-
</cfoutput>
the index page basically allows the user to choose which ticket he is editing.
When you click on the link (which displays the ticket number the user is chooseing) it takes you to page 1 of the form that shows you the title of the ticket and contact information. When you click submit on the first page of the form it then takes you to the second page of the form where you see the contact information again (which it gets the contact information correctly) an then shows the serial and parts information (which is what i am trying to show). but reason we did it in 2 pages was because its a long form so didn't want to overwhelm the user.
Thank you,
Rach
If you're not going to use the queries on page 1, there's no need for them there. On page 2, you will need to make the modifications that you've made in page 1.
Alternatively, keep everything in page 1 and show only parts and allow other parts to be shown using JavaScript.
If you're not going to use the queries on page 1, there's no need for them there. On page 2, you will need to make the modifications that you've made in page 1.
Alternatively, keep everything in page 1 and show only parts and allow other parts to be shown using JavaScript.
Hey Acoder,
ok i am a bit confused. so basically take out the serial and part table and move it onto the second page? i am just confused on what needs to stay and what needs to go.
Heres whats on page 1 - <cfquery name="ticket" datasource="CustomerSupport">
-
SELECT pk_ticketID,title,priority,status,cost_center,fk_customer_number,
-
customer_company,customer_Fname,customer_Lname,customer_add1,customer_city,customer_state,
-
customer_zip,customer_email,customer_pri_phone,customer_sec_phone,customer_notes,htpp FROM dbo.tbl_CS_ticketMaster
-
WHERE pk_ticketID = #URL.pk_ticketID#
-
</cfquery>
-
-
<cfquery name="serial" datasource="CustomerSupport">
-
SELECT pka_serialNo,pkb_fk_ticketNo,model_no,product_type,software_hardware,resolution,resolution_date,
-
verification_date,rma_data,type_hardware_failure,dept_responsibility,resolution_verified_by FROM dbo.tbl_CS_serial
-
WHERE pkb_fk_ticketNo = #URL.pk_ticketID#
-
</cfquery>
-
-
<cfquery name="parts" datasource="CustomerSupport">
-
SELECT pk_partID,fk_serialNo,fk_ticketNo,hc_partNo,part_returned,defective,submission
-
FROM dbo.tbl_CS_parts
-
WHERE fk_ticketNo = #URL.pk_ticketID#
-
</cfquery>
-
-
<cfquery name="parts" datasource="CustomerSupport">
-
SELECT pk_partID,fk_serialNo,fk_ticketNo,hc_partNo,part_returned,defective,submission
-
FROM dbo.tbl_CS_parts
-
</cfquery>
-
<cfoutput>
-
<form name="page1" id="page1" action="saveticket1edit.cfm?pk_ticketID=#pk_ticketID#"
-
method="POST" onSubmit="return validate_form();">
-
</cfoutput>
Thank you,
Rach
You can remove those queries from page 1 and put them in page 2.
You can remove those queries from page 1 and put them in page 2.
Hey Acoder,
Wow can't believe it was so simple! THANK YOU THANK YOU, YOUR AWESOME!!! If you don't mind me asking just one more question. Ok i been running into a problem where if someone does not fill out a field it doesn't show the field at all. It will show the name next to the field, but the field itself no an was wondering how would i make the field still show up even with a value applied to the field.
Example - <input type="text" name="serialnum_' + count + '" value="#pka_serialNo#">
I have tried - <cfparam name="Form.pka_serialNo" default="">
but because i have a value applied to it, it don't work so was wondering if there was a work around.
Thank you again,
Rach
The user wouldn't be entering the pk_serialno value, would they? Is pka_serialNo a query value or a form variable?
The user wouldn't be entering the pk_serialno value, would they? Is pka_serialNo a query value or a form variable?
Hey Acoder,
the pka_serialNo is the query value. I tried to put the serialnum_ as the name but ran into trouble with that as well.
Thank you,
Rach
Can you show the rest of the code that displays the query data?
Can you show the rest of the code that displays the query data?
Hey Acoder,
Its the same code i been showing you in the how to loop through this post. What happens is basically i have one record where someone didn't enter anything in the serial table or parts table an basically the serial table don't show up and some parts of the parts table shows up. An although nothing was entered in either it still needs to show up the field as blank (like if you click on add serial it shows all the fields blank). However, it instead just shows nothing. Here is what i have
Thank you,
Rach
Although this may not solve the problem, I've noticed code that may be part of the problem and will no doubt cause problems in the future. Where you have code like: - name="serialnum_' + count + '"
needs to be replaced with
You forgot to translate some of the JavaScript when converting.
Although this may not solve the problem, I've noticed code that may be part of the problem and will no doubt cause problems in the future. Where you have code like: - name="serialnum_' + count + '"
needs to be replaced with
You forgot to translate some of the JavaScript when converting.
Hey Acoder,
Yeah i was going to ask you about the count towards the end, but probably should of asked that earlier. But that still didn't solve the problem. here is what i have
Thank you,
Rach
Oh right, if you have no data in the table, it's not going to show whatever code is in the loop. What you can do is add a check for the recordcount. If it's 0, show the blank fields.
Oh right, if you have no data in the table, it's not going to show whatever code is in the loop. What you can do is add a check for the recordcount. If it's 0, show the blank fields.
Hey Acoder,
Bit confused on what you mean with the recordcount? are you meaning to do something like - <cfparam name="Form.recordcount" default="">
Thank you,
Rach
No, the recordcount of the serial query, i.e. check serial.recordcount is 0.
No, the recordcount of the serial query, i.e. check serial.recordcount is 0.
Hey Acoder,
so like this - <cfparam name="serial.recordcount" default="0">
or does it need to be somewhere else?
Thank you,
Rach
You don't need to use cfparam. Use cfif to check the query recordcount.
You don't need to use cfparam. Use cfif to check the query recordcount.
Hey Acoder,
so something like this - <cfif serial.recordcount is 0/>
an does it need to be up with the cfparam or does it need to be somewhere else?
Thank you,
Rach
Don't close it with / - close with a </cfif>
Put it wherever you want to display the empty fields (obviously including the HTML within the tags).
Don't close it with / - close with a </cfif>
Put it wherever you want to display the empty fields (obviously including the HTML within the tags).
Hey Acoder,
its still not working. An i have also noticed that if i try to click add serial it gives me an error an it takes me to this line in the javascript - var count = (document.getElementById('theValue').value -1)+ 2;
an continues to basically lead me to anything that involves count. but here is the
div part of it again.
Thank you,
Rach
The JavaScript should be something like: - var count = parseInt(document.getElementById('theValue').value) +1;
The recordcount check should contain HTML code.
The JavaScript should be something like: - var count = parseInt(document.getElementById('theValue').value) +1;
The recordcount check should contain HTML code.
Hey Acoder,
Well i am sadly still having problems. For some reason when i fixed the ending div tag to be outside the cfoutput it now has the parts part of my table working (its below this part in another table), before it would not even display those fields as having nothing applied to them, but for some reason the table don't wanna look right for it. But anyway so are you saying to wrap the html in the cfif for example - <cfif serial.recordcount is 0>
-
<table class="zpExpandedTable" id="modeltable">
-
<th class="sectiontitletick" colspan="7">
-
Serial Information #count# </th>
-
<tr>
-
<td id="paddingformultitop">Model No: </td>
-
</td>
-
<td>
-
<select name="modelno_#count#">
-
<option value="">Make A Selection</option>
-
<cfloop query="models">
-
<option value="#model#"<cfif #model# is #model_no#>selected</cfif>>#model#</option>
-
</cfloop>
-
</select>
-
</td>
-
</tr>
-
</table>
-
</cfif>
i been trying this an it doesn't seem to do anything to it. An i don't know if this helps but if i try to click on add serial it says object required.
Thank you,
Rach
What I was suggesting was to put the HTML for the blank fields in the cfif, e.g. - <!--- code that displays in loop for serials and parts --->
-
<!--- ... --->
-
<!--- now if no serials, then display empty table --->
-
<cfif serial.recordcount is 0>
-
<table class="zpExpandedTable" id="modeltable">
-
<th class="sectiontitletick" colspan="7">
-
Serial Information 1 </th>
-
<tr>
-
<td id="paddingformultitop">Model No: </td>
-
</td>
-
<td>
-
<select name="modelno_1">
-
<option value="">Make A Selection</option>
-
<cfloop query="models">
-
<option value="#model#">#model#</option>
-
</cfloop>
-
</select>
-
</td>
-
</tr>
-
</table>
-
</cfif>
What I was suggesting was to put the HTML for the blank fields in the cfif, e.g. - <!--- code that displays in loop for serials and parts --->
-
<!--- ... --->
-
<!--- now if no serials, then display empty table --->
-
<cfif serial.recordcount is 0>
-
<table class="zpExpandedTable" id="modeltable">
-
<th class="sectiontitletick" colspan="7">
-
Serial Information 1 </th>
-
<tr>
-
<td id="paddingformultitop">Model No: </td>
-
</td>
-
<td>
-
<select name="modelno_1">
-
<option value="">Make A Selection</option>
-
<cfloop query="models">
-
<option value="#model#">#model#</option>
-
</cfloop>
-
</select>
-
</td>
-
</tr>
-
</table>
-
</cfif>
Hey Acoder,
Hate to say it i am still confused. By looking at your example your implying to change modelno_#count# to modelno_1 an the thing is i still need the count there because it will have to be able to display previously entered records and also fields that they did not enter. an confused by also taking out the selected since i need the selected to show what the user selected as there option. But here is what i have. Now the add serial works correctly with no problems :). But here is what i have, bolded what is new.
Thank you,
Rach
I didn't mean to replace what you currently had, but to add to it.
However, before going any further, can you confirm that you definitely need to have something displayed for serials and parts even if there are none for a particular ticket?
I didn't mean to replace what you currently had, but to add to it.
However, before going any further, can you confirm that you definitely need to have something displayed for serials and parts even if there are none for a particular ticket?
Hey Acoder,
its ok about the replacing just making sure i can still keep it in there :).
But yes i definitely have to have something display there for serial an parts even if there was nothing applied to it to begin with. Need it because they might need to later add on to the form and if the field is not available to type in then they can't add on to it.
Thank you,
Rach
In that case, you need to keep what you had before (without the cfif) and then copy and add after <cfloop query="serial"> the <cfif recordcount ...> code. What this would do is show the previous serials if any and if none, it would display an empty table for the user to fill.
In that case, you need to keep what you had before (without the cfif) and then copy and add after <cfloop query="serial"> the <cfif recordcount ...> code. What this would do is show the previous serials if any and if none, it would display an empty table for the user to fill.
Hey Acoder
so your saying to do to every field this - <select name="modelno_#count#">
-
<option value="">Make A Selection</option>
-
<cfloop query="models"><cfif serial.recordcount is 0>
-
<option value="#model#"<cfif #model# is #model_no#>selected</cfif>>#model#</option>
-
</cfif>
-
</cfloop>
-
</select>
or something else? but here is everything inside the div, haven't added the <cfif serial.recordcount is 0> to them all yet
Thank you,
Rach
No, just one recordcount check and all tables/fields included, but blank and nothing selected.
No, just one recordcount check and all tables/fields included, but blank and nothing selected.
Hey Acoder,
I tried this but i know this aint right i guess i am just confused on where i should put it. bolded where i put them
Thank you,
Rach
No, remove the cfif around the code there and do something like: - <!--- previous code without cfif then ...--->
-
<cfif serial.recordcount is 0>
-
<!--- display empty table --->
-
</cfif>
No, remove the cfif around the code there and do something like: - <!--- previous code without cfif then ...--->
-
<cfif serial.recordcount is 0>
-
<!--- display empty table --->
-
</cfif>
Hey Acoder,
did that. Do i need to put inbetween the cfif a copy of everything above it except make the fields not have a value? here is what i have. bolded where i added it.
Thank you,
Rach
Yes, now add the same code within the cfif. Of course, you could make things easier by putting it in a separate file and including using cfinclude to reduce redundancy or use a custom tag.
Yes, now add the same code within the cfif. Of course, you could make things easier by putting it in a separate file and including using cfinclude to reduce redundancy or use a custom tag.
Hey Acoder,
Yeah i might do an include when its all done i got 1136 lines of code. If i could move the javascript into its own file it would help a lot but when i tried it ran into problems. But anyway here is what i did but still getting the same thing. heres everything between cfif
Thank you,
Rach
No, the cfif must be outside the cfoutput query unless this is copied code and the previous code is untouched in which case you need to remove all code which references the query and its fields because there are no records.
One possibility that might make sense here is to have one file which contains the table and you set the variables before you call the file. This would avoid this repetition in the code which feels wrong and looks ugly.
Note that Coldfusion generates the JavaScript, so you can't move that into its own file unless it's a Coldfusion file rather than a JavaScript one.
No, the cfif must be outside the cfoutput query unless this is copied code and the previous code is untouched in which case you need to remove all code which references the query and its fields because there are no records.
One possibility that might make sense here is to have one file which contains the table and you set the variables before you call the file. This would avoid this repetition in the code which feels wrong and looks ugly.
Note that Coldfusion generates the JavaScript, so you can't move that into its own file unless it's a Coldfusion file rather than a JavaScript one.
Hey Acoder,
Yes the previous code has been untouched (just copied everything from the previous into the cfif. But i got it to display with nothing applied to it. But i must admit i am now having the trouble i had with serial with my parts table. i thought solving serial would solve parts but didn't an having trouble with it (exact same trouble with displaying it with no value applied).
an since i am having the same trouble with parts like serial and i would really hate to have 2 sections of code repeated twice to do this so i was wondering how would i go about making the file which contains the table and set s the variables before calling the file?
but yeah i figured i couldn't move the javascript based on the fact that it uses html and coldfusion. I moved other parts of the form into there own table but was only able to do those because didn't need anything from the html or coldfusion.
Thank you,
Rach
If the parts and serials tables are significantly different, you're going to have to create two files anyway. Set all the values before including the file (which you're doing now anyway) and set them to empty for the 0 recordcount part, e.g. - <cfoutput query="serial">
-
<!--- cfset statements --->
-
<cfinclude ...>
-
</cfoutput>
-
<cfif serial.recordcount is 0>
-
<!--- cfset statements similar to above but set to "" --->
-
<cfinclude ...>
-
</cfif>
Hey Acoder,
Ok well here is what i got. But i got one question, was i suppose to use the value i assigned to each field or use the field name? i used the value i gave each field for this because was not sure. - serial table
-
<cfoutput query="serial">
-
<cfset model_no = #model_no#>
-
<cfset product_type = #product_type#>
-
<cfset type_hardware_failure = #type_hardware_failure#>
-
<cfset pka_serialNo = #pka_serialNo#>
-
<cfset software_hardware = #software_hardware#>
-
<cfset description = #description#>
-
<cfset resolution = #resolution#>
-
<cfset resolution_date = #resolution_date#>
-
<cfset resolution_verified_by = #resolution_verified_by#>
-
<cfset verification_date = #verification_date#>
-
<cfset dept_responsibility = #dept_responsibility#>
-
<cfset rma_data = #rma_data#>
-
<cfinclude template="serialdisplay.cfm">
-
</cfoutput>
-
<cfif serial.recordcount is 0>
-
<cfset model_no = "">
-
<cfset product_type = "">
-
<cfset type_hardware_failure = "">
-
<cfset pka_serialNo = "">
-
<cfset software_hardware = "">
-
<cfset description = "">
-
<cfset resolution = "">
-
<cfset resolution_date = "">
-
<cfset resolution_verified_by = "">
-
<cfset verification_date = "">
-
<cfset dept_responsibility = "">
-
<cfset rma_data = "">
-
</cfinclude>
-
</cfif>
-
-
parts table
-
<cfoutput query="parts">
-
<cfset hc_partNo = #hc_partNo#>
-
<cfset defective = #defective#>
-
<cfset submission = #submission#>
-
<cfinclude template="partsdisplay.cfm">
-
</cfoutput>
-
<cfif parts.recordcount is 0>
-
<cfset hc_partNo = "">
-
<cfset defective = "">
-
<cfset submission = "">
-
</cfinclude>
-
</cfif>
Thank you,
Rach
The cfinclude should be the same for when the record count is 0, not </cfinclude>
If the field names are the same, you can remove those declarations from inside the loop.
A thought occurred to me. Could you not have empty serial/part tables/fields regardless of whether there was 0 record count or not, i.e. an empty table always appears at the end? This would get rid of the need to check for 0 record count.
Hey Acoder,
well it doesn't always need a empty table at the end. Most of the time all of the fields should be filled in except a few. those few not filled in are the ones the person filling in the information has to wait on till the user there helping has there problem solved.But although i know most of the fields should be filled in, that might not always be the case which is why i am making sure all the fields can allow blanks in them. An i am afraid adding a table at the end of it all would confuse the users an they would think to delete it every time an we got some lazy people who would complain about having to do that.but here is what i got, whats the next step? - serial table
-
<cfoutput query="serial">
-
<cfset model_no = #model_no#>
-
<cfset product_type = #product_type#>
-
<cfset type_hardware_failure = #type_hardware_failure#>
-
<cfset pka_serialNo = #pka_serialNo#>
-
<cfset software_hardware = #software_hardware#>
-
<cfset description = #description#>
-
<cfset resolution = #resolution#>
-
<cfset resolution_date = #resolution_date#>
-
<cfset resolution_verified_by = #resolution_verified_by#>
-
<cfset verification_date = #verification_date#>
-
<cfset dept_responsibility = #dept_responsibility#>
-
<cfset rma_data = #rma_data#>
-
<cfinclude template="serialdisplay.cfm">
-
</cfoutput>
-
<cfif serial.recordcount is 0>
-
<cfset model_no = "">
-
<cfset product_type = "">
-
<cfset type_hardware_failure = "">
-
<cfset pka_serialNo = "">
-
<cfset software_hardware = "">
-
<cfset description = "">
-
<cfset resolution = "">
-
<cfset resolution_date = "">
-
<cfset resolution_verified_by = "">
-
<cfset verification_date = "">
-
<cfset dept_responsibility = "">
-
<cfset rma_data = "">
-
<cfinclude>
-
</cfif>
-
-
-
parts table
-
<cfoutput query="parts">
-
<cfset hc_partNo = #hc_partNo#>
-
<cfset defective = #defective#>
-
<cfset submission = #submission#>
-
<cfinclude template="partsdisplay.cfm">
-
</cfoutput>
-
<cfif parts.recordcount is 0>
-
<cfset hc_partNo = "">
-
<cfset defective = "">
-
<cfset submission = "">
-
<cfinclude>
-
</cfif>
Thank you :),
Rach
Sign in to post your reply or Sign up for a free account.
Similar topics
by: _link98 |
last post by:
Running DB2 ESE V8.1.8 on WinXP.
This is Fixpak 8.
Have a structured-type and some methods for that type.
One of my methods needs to do insert / update on tables.
The type specification...
|
by: PJ |
last post by:
Hello,
I am trying to use late binding to call a COM object.
I am trying to call a 'GetTables' method on the object.
It's essentially a 'MetadataService' which is used to
return the names of...
|
by: Michael |
last post by:
I'm using windows forms!
>-----Original Message-----
>Are you using ASP.NET or Windows Form? Only Windows
Forms
>DataGrid support that method.
>
>Tu-Thach
>
>>-----Original Message-----
|
by: mivey4 |
last post by:
Okay,
The problem is that I have an Access Database that has the following
fields:
EmpID - Autonumber (PrimaryKey)
AccountID - Text
IssueReported - Memo
DateOpened ...
|
by: Fred Flintstone |
last post by:
What's the difference between these two methods?
1 - Parameterrized SQL queries:
Dim CommandObject As New Data.SqlClient.SqlCommand
With CommandObject
.Connection = myConnection...
|
by: tony |
last post by:
Hello!!
Hello Victor!
I use a product called flygrid to create grid tables.
In many of my forms I create such grid tables.
Some columns in these grid tables is of type drop down list where I...
|
by: MurdockSE |
last post by:
Greetings.
My Situation:
// I have an .xml file that I am reading into a dataset in the
following code -
DataSet ds = new DataSet("MyDataset");
ds.ReadXml(@"c:\data\"+cmyxmlfilename);
|
by: rn5a |
last post by:
The .NET 2.0 documentation states the following:
When using a DataSet or DataTable in conjunction with a DataAdapter & a
relational data source, use the Delete method of the DataRow to remove...
|
by: leviwatts |
last post by:
Exception Details: System.ArgumentException: DataTable already belongs to another DataSet.
Googling for this error shows several post of people trying to manipulate a table within a dataset. Others...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |