dynamic - How can I access the query for my cfoutput dynamically, based on a query name variable? -


i have struct contains 2 queries. have variable "key" of 1 of queries, , want output query dynamically using variable. basic code:

<cfquery name="myqueries.names" ... >...</cfquery> <cfquery name="myqueries.places" ... >...</cfquery>  <cfset queryname = "places" />  <cfoutput query="myqueries[queryname]"> ... </cfoutput> 

this gives me error attribute validation error tag cfoutput.

the cfoutput "query" attribute doesn't seem support bracket notation. how can access query cfoutput?

the query attribute of cfoutput requires valid variable name, can set intermediary value , use reference query

<cfset realquery = myqueries[queryname]> <cfoutput query="realquery"> ... </cfoutput> 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -