| QUERY | Required. The name of the query you want to manipulate the column names of. Could be the results of a CFQUERY, CFLDAP, CFPOP, QueryNew(), etc. |
|---|---|
| ACTION |
Optional. Available ACTIONs are "MAKESAFE" and "NUMBER".
|
| MAKEUNIQUE | Optional. If MAKEUNIQUE="YES", then this tag will "scan" the original query columns to see if any of the columns named appear more than once in the query result set (in other words, if any two columns have the same name) and renames them with numbers if needed. If three columns were all named "Company", for instance, the first column name will be left alone, but the second one will be renamed to "Company_2", and the third one will become "Company_3". |
| COLUMNPREFIX | Optional. If omitted, defaults to "COL". If you wanted this tag to rename columns to "COLUMN_1" instead of "COL_1" and so on, you would use COLUMNPREFIX="COLUMN". |
| USEUNDERSCORE | Optional. If omitted, defaults to "YES". If you wanted this tag to rename columns to "COL1" instead of "COL_1" and so on, you would use USEUNDERSCORE="No". |
| NEWQUERY | Optional. A name for the new, "corrected" version of the query. If omitted, the new query will simply overwrite (replace) the original version of the query. |
Installation:
The CFX_QueryColumns tag must be present and registered on your CF server before you can use this
tag, because this tag depends on its fuctionality. The CFX_QueryColumns tag is included as a seperate
.zip with this tag for your convenience.
Example 1:
Making the column names "safe" and "unique" for use in your CF code: assume that the BadBlends table has three columns: "1999BLEND", "1998BLEND", and "BLEND TEXT".
After the above code runs, the columns will be named "BLEND", "BLEND1", and "BLENDTEXT", respectively.
Example 2:
Numbering the columns: assume that the Blends table has two columns: "Blend_ID" and "Blend".
The column names are:
COL_1,COL_21 Colombia Supremo
2 Espresso Roast
3 French Roast
4 Vienna Roast
5 Mocca-Java