Solved

query_name.columnList - display vertically?

Posted on 2011-03-16
5
442 Views
Last Modified: 2012-05-11
hi all,

is it possible to force a br tag after each comma in a query_name.columnList?

i can give more info if needed

z

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
  • 3
  • 2
5 Comments
 
LVL 39

Accepted Solution

by:
gdemaria earned 500 total points
ID: 35149715

<cfset newList = listChangeDelims(valueList(query_name.columnList),",<br>")>

Now newList should contains  one,<br>two,<br>three,<br>four

Of course you could also just loop through the values add format as you wish

<cfloop index="xx" list="#valueList(query_name.columnList)#">
   #xx#<br>
</cfloop>
0
 
LVL 1

Author Comment

by:bede123
ID: 35149858
many thanks. i can get both to work but it seems there might be an issue with the way i'm querying for the column names because they seem to be repeated twice:

SELECT *
FROM ProdFields
LIMIT 1

results in:

AUTOID,
PRODNAME,
AUTOID,
PRODNAME

you see how this table only has two colums but its repeated twice.

before using the SELECT *

i was using:

SHOW COLUMNS

Butr that gave me:

EXTRA
FIELD
TYPE
NULL
KEY
DEFAULT
EXTRA

which is not what i'm after as its not actually the column names.....
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 35149915
If you are after the column names, you should be able to grab them after a CFQUERY.  It doesn't matter how many records are returned 0, 1, or many

<cfquery name="myQuery" datasource="...">
  SELECT * FROM ProdFields
</cfquery>

<cfoutput>#myQuery.columList#</cfoutput>

If you're doing much more than that, perhaps there is a problem with the specific code; if so, please post the code..  Thanks
0
 
LVL 1

Author Comment

by:bede123
ID: 35149969
Yes that exactly what i was doing BUT from looking at the cfdump info i realised that by doing:

SELECT *

i was querying the db for everything in the table, and the plan is for this table to be big!

so i added:

LIMIT 1

but apart from that my code is the same as yours. even if i take the LIMIT 1 out it still returns the whole thing twice:

AUTOID
PRODNAME
AUTOID
PRODNAME




however i'm going to close the question and award the points because the original question has been answered. i will post back with a new question after i have done some googling.

many thanks again

gdemaria.


z
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 35150002
> i was querying the db for everything in the table, and the plan is for this table to be big!

you can also not return any rows, so this will work as well..

 SELECT * FROM TABLE WHERE 1 = 2

that will not return any rows, but will give you your column names

In your new question, please post some code, the problem is probably specific to your code as you have the right approach

0

Featured Post

Containers & Docker to Create a Powerful Team

Containers are an incredibly powerful technology that can provide you and/or your engineering team with huge productivity gains. Using containers, you can deploy, back up, replicate, and move apps and their dependencies quickly and easily.

Question has a verified solution.

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

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
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…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

691 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