Solved

cfquery, columnList results display twice

Posted on 2011-03-16
11
519 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
 
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ColdFusion MS SQL CSV Impport 10 64
C# script to Coldfusion 25 59
On Submit return to same spot 7 85
Coldfusion Datefield problem 2 96
Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

910 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now