SEO | Link Popularity | Search Engine Consulting | SEO Tutorial | SEO Tools | SEO Forum
Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 06-02-2004, 06:45 AM
shemp shemp is offline
SEO Junior
 
Join Date: Jun 2004
Posts: 1 shemp is on a distinguished road
Cflooping a cfinsert

New here, hope you can help.


I am working on an organizational / task management web interface for my company.

Mangers assign individual and multiple (All) tasks to employees from a web page.

When assigning a task that applies to All of their employees, each person is automatically generated an email. No problem here…

In my table called tblAll I have 3 fields, “chlID” (task ID), “proID” (profile ID, task owner), and “comp” (yes/no completed). The tasks and people profiles are stored in separate tables. The tblAll is just a tracking table for this specific function.

From my form I am passing a variable, “chlID” and also a URL variable “proID”. The “proID” that is passed is the person who is assigning the task.

Here is my problem…

Say a manager has 20 people under them. When I create an All People Task and execute the code below, I get 20 records in my table that are identical. The loop is not going to the next “proID” in the list. I have tried cfloop query, index, condition, etc., etc., to no avail.

I know I need to include a cfif statement in there somewhere….

Help pleeeze!!! My boss is breathing down my neck to get this done.

P.S. The “supID” in the query is the supervisor ID (who someone reports to).

CODE

<cfparam name="FORM.chlID" default="1">
<cfparam name="URL.proID" default="1">

<cfquery name="org" datasource="vso">
SELECT proID
FROM tblProfile WHERE supID = #URL.proID#
</cfquery>

<cfloop query="org">
<cfset FORM.proID=(“#proID#”)>
<cfset FORM.comp=0>
<cfinsert datasource="vso" tablename="tblAll" formfields="chlID, proID, comp">
</cfloop>

<cflocation url="assignedChlMgr-03-confirm.cfm?proID=#URL.proID#">
Reply With Quote
  #2  
Old 06-02-2004, 09:07 PM
laura's Avatar
laura laura is offline
Premium member
 
Join Date: Apr 2004
Posts: 142 laura is on a distinguished road
Sorry, it took so long to get back to you I didn't notice the post
I'll do my best to help but right now I'm in an ASP state of mind and having trouble getting my mind to switch back

If I'm reading your question correctly this is actually alot harder than it looks. I would drop the cfinsert statement in this case and use an SQL insert. Try this swipped code and let me know how it goes. Of course change it to fit your needs.


Code:
Here's the source code:-
FORM PAGE:-
<cfform action="DrawingAddTest.cfm?submit=yes" method="post" name="submitform">
<font color="#003399"><b>Total Rows to Input:</b></font>
<input type="Text" name="totalrow" value="" size="4" maxlength="4">
  <input type="Submit" value="Submit" class="bu">  
</cfform>   
<cfif isdefined("url.submit")>
<TABLE BORDER="2" CELLPADDING="0" CELLSPACING="1" BORDERCOLOR="#cc6699">  
<TR>
  <TH><font color="#333399">Drawing No</font></TH>
  <TH><font color="#333399">Drawing Name</font></TH>
  <TH><font color="#333399">Received Date(dd/mm/yyyy)</font></TH>
  <TH><font color="#333399">Alt. No</font></TH>
  <TH><font color="#333399">Sub Drawing No</font></TH>  
  <TH><font color="#333399">Spec. No</font></TH>
  <TH><font color="#333399">Remarks</font></TH>
  <TH><font color="#333399">Rnd Eng</font></TH>
  <TH><font color="#333399">Origin</font></TH>  
</TR>
<cfset J = #totalrow#>
<cfloop index="NewRow" from="1" to="#totalrow#">
<cfset J = J - 1>
<form name="myform" action="DrawingAddActionTest.cfm?sum=<cfoutput>#totalrow#</cfoutput>" method="post">
<tr>
    <td><INPUT TYPE="text" NAME="DwgNo<cfoutput>#NewRow#</cfoutput>" SIZE="15"></td>
     <td><INPUT TYPE="text" NAME="DwgNm<cfoutput>#NewRow#</cfoutput>" SIZE="15"></td>
    <td><INPUT TYPE="text" NAME="RDate<cfoutput>#NewRow#</cfoutput>" SIZE="14"></td>
     <td><INPUT TYPE="text" NAME="Altno<cfoutput>#NewRow#</cfoutput>" SIZE="8"></td>
     <td><INPUT TYPE="text" NAME="Sdwgno<cfoutput>#NewRow#</cfoutput>" SIZE="10"></td>
     <td><INPUT TYPE="text" NAME="Specno<cfoutput>#NewRow#</cfoutput>" SIZE="8"></td>
     <td><INPUT TYPE="text" NAME="Rmk<cfoutput>#NewRow#</cfoutput>" SIZE="8"></td>
     <td><INPUT TYPE="text" NAME="rneng<cfoutput>#NewRow#</cfoutput>" SIZE="5"></td>
    <td><INPUT TYPE="text" NAME="Org<cfoutput>#NewRow#</cfoutput>" SIZE="4"></td>
</tr>
</cfloop>
</table>
<br>
<div align="center">
<input class="bu" type="submit" value="Add" Name="Add" style="WIDTH: 70px; HEIGHT: 30px" size=30>
</div>
</form>
</cfif>

ACTION PAGE:-
<cfloop index="ThisRow" from = "1" to = "#url.sum#">
<cfquery datasource="JESEng">
  INSERT INTO Drawing(DwgNo,DwgNm,RDate,Altno,SdwgNo,SpecNo,Rmk,  rneng,Org)
    VALUES('#Evaluate("DwgNo" & ThisRow)#','#Evaluate("DwgNm" & ThisRow)#',
            '#Evaluate("Rdate" & ThisRow)#','#Evaluate("Altno" & ThisRow)#',
             '#Evaluate("Sdwgno"& ThisRow)#','#Evaluate("Specno"& ThisRow)#',
             '#Evaluate("Rmk" & ThisRow)#','#Evaluate("rneng" & ThisRow)#',
            '#Evaluate("Org" & ThisRow)#')
</cfquery>
</cfloop>
__________________
Orlando Cars
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Login/Register
User Name
Password
Remember Me?

Forum Links
Forum Home
SEO Forum
Internet Marketing Forum
Web Design Forum
Web Hosting Forum
Programming Forum
SEO Chat

Quick Links
Forum Home
New Posts
Mark Forums Read
Open Buddy List
User Control Panel
Edit Avatar
Edit Profile
Edit Options
Miscellaneous
Subscribed Threads
My Profile

Search Forums

Advanced Search
All times are GMT -8. The time now is 06:56 PM.


Powered by: vBulletin Version 3.0.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.