|
Hi Kevin, with that situation you don't need the evaluate most of the
time. When working with dynamic variable names you need evaluate when your doing 2 things. 1. Generating the variable from other variables and constants. 2. Then pointing to the data that the variable represents. Your doing #1 but it looks like most of the time your not going doing
#2. Here are some examples. When using cfoutput or cfloop
you can just use: <cfoutput query="#cityname#_get_query"> This works because all you need to do is generate the string name of
the query, you don't need to reference the query directly, the
cfoutput tag does that for you. That is why you don't
have to do this: <cfoutput query="#recordset1#"> You just have to do this: <cfoutput query="recordset1"> When using cfdump you will need the evaluate: <cfdump var="#evaluate('#cityname#'_get_query')#"> Because cfdump doesn't want
the variable name, but a reference to the data itself. Which is why you have to do this: <cfdump var="#recordset1#"> Instead of this: <cfdump var="recordset1"> When outputting data you will need evaluate. <cfoutput> First row of first column: #evaluate("#cityname#_get_query.column1[1]")# </cfoutput> This is because once again you need to do #1 and #2. Hints this won't
work: <cfoutput> Recordset1.column1[1] </cfoutput> It obviously goes like this: <cfoutput> #recordset1.column1[1]# </cfoutput> If you need to do this frequently.
It might be worth to build an alternate structure for the data. If you placed
some of the data in a struct of structs
you could use syntax like this: get_query[“#cityname#”][column_name][row_number] It’s a way to dynamically select the variable without using the evaluate. You would have to create a custom loop to
populate the structs for your querys.
But if you save it in the application scope it will be minimum overhead and you
can avoid using the evaluate function for outputting data. Hope that helps -----Original Message----- Daniel, I am using the evaluate command to determine which query to pull data
from. The reason for this is there are multiple queries for different cities
and I would like to cache the query.
The sites for the different cities pull the data from the query based upon the city name in the application
page. For example, we have a site for a site for for each city I have a variable for cityName, therefore, I am using #evaluate(cityName & '_get_query')#. Do you recommend another way? Thanks for the advise! Kevin -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Sent: Friday, December 17, 2004 5:01 PM To: Subject: RE: evaluate The evaluate function is processor intensive. You should avoid it
whenever possible. However, in some situation it is necessary and then you
should use it and not feel guilty. It takes a good understanding of CF syntax to
know when it is necessary. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Kevin Fricke Sent: Friday, December 17, 2004 3:28 PM To: CFLIST Subject: evaluate Is there any reason to avoid using the evaluate command? Does it slow down processing? Thanks, kevin ---------------------------------------------------------- To post, send email to To unsubscribe: http://www.dfwcfug.org/form_MemberUnsubscribe.cfm To subscribe:
http://www.dfwcfug.org/form_MemberRegistration.cfm ---------------------------------------------------------- To post, send email to To unsubscribe: http://www.dfwcfug.org/form_MemberUnsubscribe.cfm To subscribe:
http://www.dfwcfug.org/form_MemberRegistration.cfm ---------------------------------------------------------- To post, send email to To unsubscribe:
http://www.dfwcfug.org/form_MemberUnsubscribe.cfm To subscribe:
http://www.dfwcfug.org/form_MemberRegistration.cfm |
- evaluate Kevin Fricke
- RE: evaluate Daniel Elmore
- RE: evaluate Kevin Fricke
- RE: evaluate Daniel Elmore
- RE: evaluate Kevin Fricke
- RE: evaluate Daniel Elmore
