|
Prev: can you not set a variable that's in the same scope as a querystructure
Next: Question on storing queries in session arrays
From: paross1 on 22 Apr 2008 12:27 FYI, just a note of caution. When using the solution that I posted, if your query returns more than one row, and you use CFSET after your CFQUERY to set the pseudo column with a value, only [b]one row[/b] will have a value set and the remaining rows will still be NULL. If you do something like this instead, and set the column to a value using a [i]constant[/i] within the query: cfquery datasource="mydb" name="note_this_name" > select columnone, columntwo, 'i_will_never_be_able_to_use_this_variable' AS not_a_column_name from tbl_mytable </cfquery> then every row returned would contain the value of 'i_will_never_be_able_to_use_this_variable' in the not_a_column_name column. Phil
From: -==cfSearching==- on 22 Apr 2008 19:59
happysailingdude wrote: [i] <cfset note_this_name.not_a_column_name = "i_will_never_be_able_to_use_this_variable" > ... and i get this error " Element not_a_column_name is undefined in note_this_name" How on earth can this be? am i going mad?[/i] Though this was mentioned already, I think it is worth clarifying. You [i]cannot[/i] implicitly add a column to a query that way. A query is not the same type of object as a CF structure. So AFAIK you cannot apply that particular technique to queries. To add a column your must use one of the options Ian and Phil mentioned. |