I guess I need more coffee in the morning.

This should do it for you:
INSERT INTO tblEquipEntry 
VALUES
(tblequipentry_seq.nextval,1000,
#Val(Evaluate("Form.chooseequip" & counter))#,
#Val(Evaluate("Form.hours" & counter))#
)


-----Original Message-----
From: Fred jambukeswaran 
Sent: Wednesday, November 21, 2001 3:45 PM
To: CF-Talk
Subject: RE: Looping through list of variables


I forgot the hash marks around the variables:

INSERT INTO tblEquipEntry 
VALUES
(tblequipentry_seq.nextval,1000,
#Val(Evaluate(Form.chooseequip & counter))#,
#Val(Evaluate(Form.hours & counter))#
)

-----Original Message-----
From: Fred jambukeswaran 
Sent: Wednesday, November 21, 2001 3:36 PM
To: CF-Talk
Subject: RE: Looping through list of variables


I believe your problem is the variable scope your using.

You'll need to reference it as
Form.chooseequip#counter#

Not
EquipmentForm.chooseequip#counter#

Also your sending the data into your database unchecked. 

I'd recommend evaluating and verifying all the data you need into a
structure then loop over the structure and insert the data into the
database. At the very least put a simple val function around your evaluate:


INSERT INTO tblEquipEntry 
VALUES
(tblequipentry_seq.nextval,1000,
Val(Evaluate(Form.chooseequip & counter)),
Val(Evaluate(Form.hours & counter))
)

Try that,

-Frederic Jambukeswaran


-----Original Message-----
From: Angel Stewart [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 21, 2001 2:06 PM
To: CF-Talk
Subject: Looping through list of variables


Hey all.

I have a form with variables nammed chooseequip1,
chooseequip2,chooseequip3...5

Now I want to check if each of these is empty, and if not then insert
data.

Of course I need to reference them. I tried using a CFLOOP but I am
running into problems with referenceing the fields with evaluate.

<cfloop index="counter" from="1" to="5" step="1">

        <cfif len(evaluate('EquipmentForm.chooseequip#counter#'))>
                
                <cfquery name="InsertEquipment" dbtype="Oracle80">
        
        
                        INSERT INTO tblEquipEntry 
                        
                        VALUES
(tblequipentry_seq.nextval,1000,#Evaluate('#EquipmentForm.chooseequip##c
ounter#')#,#Evaluate
('#EquipmentForm.hours##counter#')#)
                        
                </cfquery>

        </cfquery>

</CFLOOP>


Any ideas on the correct way to reference those fieldvalues?

-Gel



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to