Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

QueryAddColumn then populate it

9 views
Skip to first unread message

noe....@gmail.com

unread,
Jan 17, 2017, 1:27:07 PM1/17/17
to
Hi all,

Wondering if there is a way to add a column to a query, then set the value for the current row on that column? Something like:

<cfset QueryAddColumn( queryA, #variable1# )>

<cfset QuerySetCell( queryA, #variable1#, #variable2# )>

Adding the column works just fine, but QuerySetCell doesn't seem to like a variable column name.

Thanks,
Todd

mrjung...@gmail.com

unread,
Jan 31, 2017, 3:18:03 PM1/31/17
to
This seems to work (using CF11):

<cfset variable1 = "col3" />

<cfset queryA = queryNew("col1, col2", "VarChar, VarChar") />
<cfset queryAddColumn(queryA, "#variable1#", "VarChar", #arrayNew(1)#) />

<cfset queryAddRow(queryA, 1) />
<cfset querySetCell(queryA, "col1", "here", 1) />
<cfset querySetCell(queryA, "col2", "there", 1) />
<cfset querySetCell(queryA, "#variable1#", "and everywhere", 1) />

<cfdump var="#queryA#" label="" />

0 new messages