[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.8

DELETING RECORDS when the Primary Key is NOT NULL.......the rest of the Record IS NULL

Asked by inverted_2000 in Miscellaneous Web Development

Tags: key, primary

Help Pleassssssssssse.

I have a CF web page form that loops 10 times to give my users the option to insert multiple, up to 10, truck loads of freight into my database at once.  The problem here is that the loop requires the Primary Key "id" to tell the difference between the rows of text fields.  "id" is the ELEMENT.  So regarless of what the user inputs in the form, 10 records will be inserted into the database because that "id" is still defined for each row of input fields.  This will cause the database to fill up fast with empty records.

I need to delete the records that don't have any data in the rest of the record except for the "id".  For example.  My users will always enter a date into the date text field in order to specify when a truck load is available.  If that date field is Null, can I make that condition cause an CFIF statement to begin a query to delete the rest of the record on the actionpage?....and how might I do that. My action page's code is below

Thanks
Chris

-------------------------------------------------------------------------------------------------------------------------------------
Begin Code
-------------------------------------------------------------------------------------------------------------------------------------
<cfloop list="#form.updatelist#" index="id">
<cfquery name="insertLoads" datasource="ADOpenFreight">
INSERT INTO freight (
              <cfif "form.dc" & id NEQ "">
              dc,
              </cfif>  
              <cfif "form.trailer" & id NEQ "">      
          trailer,
              </cfif>
              <cfif "form.terminal" & id NEQ "">
          terminal,
              </cfif>
              <cfif "form.fromcity" & id NEQ "">
          fromcity,
              </cfif>
              <cfif "form.fromstate" & id NEQ "">
          fromstate,
              </cfif>
              <cfif "form.tocity" & id NEQ "">
          tocity,
              </cfif>
              <cfif "form.tostate" & id NEQ "">
          tostate,
              </cfif>
              <cfif "form.commodity" & id NEQ "">
          commodity,
              </cfif>
              <cfif "form.length" & id NEQ "">
          length,
              </cfif>
              <cfif "form.width" & id NEQ "">
          width,
              </cfif>
              <cfif "form.height" & id NEQ "">
          height,
              </cfif>
              <cfif "form.rate" & id NEQ "">
          rate,
              </cfif>
              <cfif "form.weight" & id NEQ "">
          weight,
              </cfif>
              <cfif "form.miles" & id NEQ "">
          miles,
              </cfif>
              <cfif "form.contact" & id NEQ "">
          contact,
              </cfif>
              <cfif "form.phone" & id NEQ "">
          phone,
              </cfif>
              <cfif "form.notes" & id NEQ "">
          notes
              </cfif>)
VALUES (  
              <cfif "form.dc" & id NEQ "">
              '#evaluate("form.dc" & id)#',
              </cfif>
              <cfif "form.trailer" & id NEQ "">
              '#evaluate("form.trailer" & id)#',
              </cfif>
              <cfif "form.terminal" & id NEQ "">
          '#evaluate("form.terminal" & id)#',
              </cfif>
              <cfif "form.fromcity" & id NEQ "">
          '#evaluate("form.fromcity" & id)#',
              </cfif>
              <cfif "form.fromstate" NEQ "">
          '#evaluate("form.fromstate" & id)#',
              </cfif>
              <cfif "form.tocity" & id NEQ "">
              '#evaluate("form.tocity" & id)#',
              </cfif>
              <cfif "form.tostate" & id NEQ "">
              '#evaluate("form.tostate" & id)#',
          </cfif>
              <cfif "form.commodity" & id NEQ "">
              '#evaluate("form.commodity" & id)#',
          </cfif>
              <cfif "form.length" & id NEQ "">
              '#evaluate("form.length" & id)#',
          </cfif>
              <cfif "form.width" & id NEQ "">
              '#evaluate("form.width" & id)#',
          </cfif>
              <cfif "form.height" & id NEQ "">
              '#evaluate("form.height" & id)#',
              </cfif>
              <cfif "form.weight" & id NEQ "">
          '#evaluate("form.weight" & id)#',
              </cfif>
              <cfif "form.rate" & id NEQ "">
          '#evaluate("form.rate" & id)#',
              </cfif>
              <cfif "form.miles" & id NEQ "">
          '#evaluate("form.miles" & id)#',  
              </cfif>
              <cfif "form.phone" & id NEQ "">      
          '#evaluate("form.phone" & id)#',
              </cfif>
              <cfif "form.contact" & id NEQ "">
          '#evaluate("form.contact" & id)#',
              </cfif>
              <cfif "form.notes" & id NEQ "">
          '#evaluate("form.notes" & id)#'
              </cfif>)
</cfquery>
</cfloop>
<CFLOCATION URL="insertmultiple.cfm">
[+][-]08/06/04 01:31 PM, ID: 11739253Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Miscellaneous Web Development
Tags: key, primary
Sign Up Now!
Solution Provided By: jdoklovic
Participating Experts: 2
Solution Grade: A
 
[+][-]08/06/04 09:59 AM, ID: 11737454Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/06/04 10:16 AM, ID: 11737613Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/06/04 01:32 PM, ID: 11739260Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/06/04 01:45 PM, ID: 11739361Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/06/04 01:53 PM, ID: 11739442Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091118-EE-VQP-93