> What's the difference between these expressions or have I
> misunderstood the use of evaluate:
>
> <CFSET NewValue = OldValue + NextValue>
> <CFSET NewValue = evaluate(OldValue + NextValue)>
You've misunderstood the use of Evaluate, I think. You use it on strings, so
that you can treat a string as if it were a variable name. For example, you
might have a variable number of form fields that all have a number at the
end, and you might want to loop through all of them and retrieve their
values. In the example below, there's a form field called NumberOfFields
that is used to determine how many times the loop should iterate:
<cfloop index="i" from="1" to="#Form.NumberOfFields#">
<cfset ThisName = Evaluate("Form.Name" & i)>
<cfquery name="qInsName" datasource="ds">
INSERT INTO FooTable
(Name)
VALUES
('#ThisName#')
</cfquery>
</cfloop>
In the example, Evaluate is used to determine the value of a specific form
field, based on a string concatenation that matches the name.
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.