Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have a page that I need help with

Status
Not open for further replies.

tc3596

Technical User
Mar 16, 2001
283
I have a page that I need help with. I'm new to Web Programming. I'm using Coldfusion 5 and returning a query from SQL Server. I have my results displayed in a table. One of the columns has repeated information in it. This is my ultimate goal.

col1 col2 col3
Tim 1 2
Tim 2 3
Tim 3 4
Jim 1 2
.
.
.

How do I get it tpo show...


col1 col2 col3
Tim 1 2
2 3
3 4
Jim 1 2
.
.
.
 
I appreciate your comments, but the programming (formatting tables) involves HTML for this, not Coldfusion. So, forget the word Coldfusion. Do you agree?
 
Even forgetting the CF part, you say that you currently have it returning in the following format:


col1 col2 col3
Tim 1 2
Tim 2 3
Tim 3 4
Jim 1 2


So you already have the HTML part working, so this is 100% an SQL and CF question.

TT has different forums for a reason.

Hope this helps

Wullie


The pessimist complains about the wind. The optimist expects it to change.
The leader adjusts the sails. - John Maxwell
 
Ok, let's say I have an HTML table

<table>
<tr>
<td>col1
</td>
<td>col2
</td>
</tr>
</table>

if col1 comes from a database with 10 records and col1 = 'TIM' for the first 5 records. Is there a way (thru HTML) that I can have my col1 do a dynamic rowspan over the records 1 thru 5 (although I wouldn't know that 5 was the number of records that 'TIM' occurred)? If you don't know the answer, than just say so.
 
Hi Mate,

You are trying to do this the hard way.

Just output the records into the table, and for the cell with Tim etc, just output the name to the top cell, then output &amp;nbsp; to the rest.

Tim 1 2
Tim 2 3
Tim 3 4
Jim 1 2

<table>
<tr>
<td>Tim</td><td>1</td><td>2</td>
</tr>
<tr>
<td>&nbsp;</td><td>2</td><td>3</td>
</tr>
<tr>
<td>&nbsp;</td><td>3</td><td>4</td>
</tr>
<tr>
<td>Jim</td><td>1</td><td>2</td>
</tr>
</table>

Hope this helps

Wullie


The pessimist complains about the wind. The optimist expects it to change.
The leader adjusts the sails. - John Maxwell
 
Wullie's right, this has nothing to do with HTML, it's strictly CF. You will need to specify a grouping either in your query or in your cfoutput tags. By specifying a group, it will basically take &quot;Tim&quot; and output everything for Tim, then take &quot;Jim&quot; and output everything for Jim, etc...

Hope this helps!

 
Wow, 2 against 1. As I am new to Web programming, it is hard for me to dispute you guys on this matter. I work alot with SQL and Reporting tools (Crystal Reports). In SQL, the data (even if you group data) will still come visually showing all TIM's in the column. That's a fact, so SQL can't format the data, it only extracts the data. In Crystal, it's easy to suppress duplicate information, you just click a button. In HTML, I don't know. If I was populating the data manually (i.e a static table that never changes), I believe the approach of setting TIM to the first column and the rest to spaces would work. I imagine HTML cannot handle resultsets from a database very well. Is this correct? Anyway, I'm looking into integrating Crystal into my Web Pages, but not sure if it will bring over all formatting (i.e. lines, etc...) But, that's for another forum. Thanks for your help on this.
 
I imagine HTML cannot handle resultsets from a database very well. Is this correct?

HTML can not interact with a database in any way, it is only used to display the data after the query has run, hence this being in the wrong forum.



Wullie


The pessimist complains about the wind. The optimist expects it to change.
The leader adjusts the sails. - John Maxwell
 
HTML can however display your 2d resultset as a table of rows and columns quite well. The quick solution has already been suggested: replace doubled instances of names with a space.

If I were doing this, I'd do the replacing when I get my recordset in ASP. Whether I replace or not, the way I produce the HTML table would stay the same. So, I think you need to look to doing it with CF, which i've never used.

As wullie said, its probably worth asking in the CF forum. This forum will be really good with helping you format & display whatever data you end up with though :)

Posting code? Wrap it with code tags: [ignore]
Code:
[/ignore][code]CodeHere
[ignore][/code][/ignore].
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top