Solved

Build dynamic table output

Posted on 2014-11-03
1
164 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
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 …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

705 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