Question : Inserting Multiple Records without the Coldfusion Evaluate Function...

I've been using evaluate for a while to update or insert multiple records but I've been reading that evaluate isn't the best technique to use for performance. Anybody have any other snippets of how they achieve this in another way?

I'm currently working on a project where I have a dynamic list of text fields that I would like to insert into a table but only if the fields are not empty.

Thank you,

Brian

Answer : Inserting Multiple Records without the Coldfusion Evaluate Function...

you can use associative array notation instead of evaluate() in most cases.

suppose you have text fields text1, text2, ..., textN in your form. then on the action page you can access them inside a cfloop like this without evaluate() function:

<cfloop from="1" to="N" index="x">
#form["text" & x]#
</cfloop>

if you post your code that uses evaluate(), then we can show you how to change it to use array notation.

all the above said, evaluate() is not as bad as it used to be in cf6 and before... it's just that there are really very few cases where one needs to use it.

Azadi
Random Solutions  
 
programming4us programming4us