Solved

Build dynamic table output

Posted on 2014-11-03
1
160 Views
Last Modified: 2014-11-04
I am trying to figure out a way on how to display the output of a database query in coldfusion
a bit different. Instead of having data displayed in rows and the columnheader is the field
name, i want to have the field names in the rows and each record show be a seperate column.

Like this

User ID           00               01              02
Name             Tom            Steve         Mike
Gender           M                M                M

What is the best way to achieve this ?

Thanks
0
Comment
Question by:AlexPonnath
[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
1 Comment
 
LVL 39

Accepted Solution

by:
gdemaria earned 500 total points
ID: 40420689
The key is to refer to each query value using the structure format, that way you don't have to do the traditional CFOUTPUT loop, but can control your loop.

Reference name using    myQuery['name'][kk]   where kk is the row number and the column name is in quotes 'name'

So now you can loop across the row and have each column with a different record, like this..

<tr>
  <td>Name</td>
<cfloop index="kk" from=1 to="#myQuery.recordCount#">
    <td>#myQuery['name'][kk]#</td>
</cfloop>
</tr>

do the same for the other columns..
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Suggested Solutions

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…
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…

696 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