Solved

cfquery, columnList results display twice

Posted on 2011-03-16
11
528 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Having an issue with NumberFormat 7 66
Coldfusion Datefield problem 2 137
Browser back button refreshing coldfusion iframe 6 94
Coldfusion RegEx 8 89
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…
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

739 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