Solved

cfquery, columnList results display twice

Posted on 2011-03-16
11
524 Views
Last Modified: 2012-06-27

i'm using this query to pull column names:

SELECT *
FROM ProdFields
WHERE 1 = 2

i'm using this to output the results:

<cfset ColList = listChangeDelims(valueList(GetCurrentProdFieldNames.columnList),",</br>")>
<cfoutput>#ColList#</cfoutput>

the table that i'm querying only has two columns currently but i view the output i see them duplicated like so:

AUTOID
PRODNAME
AUTOID
PRODNAME


any ideas why?

0
Comment
Question by:bede123
  • 4
  • 4
  • 3
11 Comments
 
LVL 1

Author Comment

by:bede123
ID: 35150662
just an update to this problem. it seems to repeat itself depending on how many colums there are.
i.e. i now have 5 columns so the output block repeats 5 times.
0
 
LVL 39

Assisted Solution

by:gdemaria
gdemaria earned 167 total points
ID: 35150706

I am guessing you have two sets of CFOUTPUT tags, you cannot nest them unless you are grouping

Try removing the cfoutput tags

<cfset ColList = listChangeDelims(valueList(GetCurrentProdFieldNames.columnList),",</br>")>

#ColList#


0
 
LVL 1

Author Comment

by:bede123
ID: 35150853
yeah i tried that first off. but the output is just:

#ColList# and not data
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 39

Expert Comment

by:gdemaria
ID: 35150940
Please show your block of code all around this item..
0
 
LVL 52

Accepted Solution

by:
_agx_ earned 333 total points
ID: 35150990
<cfset ColList = listChangeDelims(valueList(GetCurrentProdFieldNames.columnList),",</br>")>
<cfoutput>#ColList#</cfoutput>

Why are you using valueList? ColumnList returns the names of the columns in the query. So you normally use it *instead* of valueList.  ValueList() is for when you want to generate a list of values in the query.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 35151022
To show the column names, try

<cfset ColList = listChangeDelims(GetCurrentProdFieldNames.columnList,</br>)>
<cfoutput>#ColList#</cfoutput>
0
 
LVL 52

Assisted Solution

by:_agx_
_agx_ earned 333 total points
ID: 35151037
With quotes obviously :)

<cfset ColList = listChangeDelims(GetCurrentProdFieldNames.columnList, ",</br>")>
<cfoutput>#ColList#</cfoutput>
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 35151052

oh crap, of course... you are trying to show the list of column names...

Good catch agx


I couldn't see the forest through all the trees
0
 
LVL 52

Expert Comment

by:_agx_
ID: 35151148
That was me yesterday :) Tag, you're it.
0
 
LVL 1

Author Comment

by:bede123
ID: 35151800
LOL

sorry for slow reply. had to travel home.

thanks for you input peeps.

agx was right, didnt need the value list in there. seems to be working great!

many thanks
zac
0
 
LVL 1

Author Closing Comment

by:bede123
ID: 35151819
sorry for planting so many trees! :-)
0

Featured Post

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question