?
Solved

Build dynamic table output

Posted on 2014-11-03
1
Medium Priority
?
167 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 2000 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

Quick Cloud Training

Looking for some quick training on the cloud in 2 hours or less? Check out these how-to guides in AWS, Linux, OpenStack, Azure, and more!

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…
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

765 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