Bec, I think I may have found an answer to this, but I need to test on MX.
I have Query1, which outputs the Attribute list, or column names of my table. When I run the query, I get a count of the number of attributes. I then dynmaically create my SELECT statement in Query2 using the attributes from Query1. However, when I create the attributes, I give them names, using: "AS QueryColumn" & IndexNo Where IndexNo is an incrementing variable. So when I output, I output Query2, and spit out: variables[QueryColumn & IndexNo]. Not sure if this works, Mark Mandel, is this the correct syntax? Chad who just finished an enjoyable read of Mark's blog and feels much closer now to him as a person On 5/18/05, Bec Gorton <[EMAIL PROTECTED]> wrote: > so what about getting column values dynamically out of queries? > > I'm building xml code out of values in the db. > Due to annoying standard issues the column names are not the same as the > attribute names. So i'm storing them in an array as pairs. I then need to > get the values out of the database and build my xml string. > My function currently used evaluate but its very slow. And ugly. Any > ideas? > > <!--- > - generateAttributes > - > - Will generate the attribute string based on the given attribute array > and query resultSet. > - > - Arguments: > - attributes : The 2D array containing the attributes names and > the > column names. > - > - eg > - attributes[1][1] = column_name > - attributes[1][2] = axl atttribute_name > - > resultSet : The record containing the values. > - Returns: > - The attribute text. > - > ---> > <cffunction name="generateAttributes" access="public" > returntype="string"> > <cfargument name="attributes" type="array" required="yes"> > <cfargument name="resultSet" type="query" required="yes"> > > <cfset text = ""> > > <cfoutput query="resultSet"> > > <cfloop index="index" from="1" to= > "#arraylen(attributes)#"> > > <cfset value_string = > evaluate(#attributes[index][1]#)> > > <cfif value_string is not ''> > <cfset text = text & > #attributes[index][2]# & '="' & #value_string# & '" '> > </cfif> > > </cfloop> > </cfoutput> > > <cfreturn text> > </cffunction> > </cfcomponent> > > --- > You are currently subscribed to cfaussie as: [EMAIL PROTECTED] > To unsubscribe send a blank email to [EMAIL PROTECTED] > Aussie Macromedia Developers: http://lists.daemon.com.au/ > --- You are currently subscribed to cfaussie as: [email protected] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/
