SunQuest
           ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old December 2nd, 2004, 03:56 PM
FALCONSEYE FALCONSEYE is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 377 FALCONSEYE Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 16 h 57 m 14 sec
Warnings Level: 15
Number of bans: 1
Reputation Power: 0
Question Creating dynamic table but how?

i have a <cfquery> that gets the following results

break NumOfBreaks Type date
----- - ---- ----
1200 2 SOFT Monday
2940 4 SOFT Monday
4800 2 INT Monday
6540 4 SOFT ..
8400 2 SOFT ..

since the query output changes depending on the date interval a user picks, i am trying to output this information in a table. so, the table will look like

Monday Tuesday .... Sunday
----------------------------------------
1200 | soft | | |
| soft | | |
--- -------------------------------------
| int | | |
2940 | int | | |
| int | | |
| int | | |
-----------------------------------------

and so on,

my problem is when i use the following code, the cells go all over the place,

<cfoutput query="getResults">
<cfset rs = NumOfBreaks
<tr>
<th scope="row" rowspan="#rs#">#BreakTime#</th>
<td >&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</cfoutput>

does anyone know how to make this happen? i guess it has something to do with rowspan, but i couldnt figure it out yet.
thanks in advance

Reply With Quote
  #2  
Old December 3rd, 2004, 09:12 AM
bocmaxima's Avatar
bocmaxima bocmaxima is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Aug 2004
Location: Tucson, Sonora
Posts: 1,322 bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 17 h 46 m 5 sec
Reputation Power: 22
Send a message via AIM to bocmaxima
For one, it's kind of strange to use TH for a sidebar since it's supposed to be a header.
Second, since you have the TH tag in the <cfoutput query=""> tag, it will be written for each row/result and thus screw up your table, especially since you have a rowspan on it but are only writing one row per record.
Third, if you want a record count, use the queryName.recordcount property. If you're looking for the number of fields in your query, use the queryName.columnlist property.
More on CF query variables

I may not understand what you're trying to do, but it sounds like the best way to go about this would be to loop through the deliminated field list prior to looping through the query to get the headers (using TH), and then, in that query loop, again loop through the fields to create your dynamic table.

Reply With Quote
  #3  
Old December 3rd, 2004, 09:36 AM
FALCONSEYE FALCONSEYE is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 377 FALCONSEYE Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 16 h 57 m 14 sec
Warnings Level: 15
Number of bans: 1
Reputation Power: 0
after i posted, i realized that the table i wanted to display got crashed. i know the recordcount, my problem is to display various rowspans. say with 1200 records i want two rows, with 1400 records i want four rows.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Monday|&nbsp;&nbsp;Tuesday|&nbsp;&nbsp;Wednesday|..&nbsp;&nbsp;&nbsp;&nbsp;..|Sunday|<p></p>
1200&nbsp;&nbsp;|Soft&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;Int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|........<p></p>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|Int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Int&nbsp;&nbsp;&nbsp;|...<p></p>
1400&nbsp;&nbsp;|Soft&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;Int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|....<p></p>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|Int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Soft&nbsp;&nbsp;&nbsp;|...<p></p>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|Int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Soft&nbsp;&nbsp;&nbsp;|...<p></p>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|Int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Soft&nbsp;&nbsp;&nbsp;|...<p></p>


how do i change the number of rows on the second, third, fourth, .... dynamically depending on my recordcount?

Reply With Quote
  #4  
Old December 3rd, 2004, 09:37 AM
FALCONSEYE FALCONSEYE is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 377 FALCONSEYE Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 16 h 57 m 14 sec
Warnings Level: 15
Number of bans: 1
Reputation Power: 0
unbeliviable,
if you can copy past the part with &nbsp; on your html editor you will see what i am trying to do.

Reply With Quote
  #5  
Old December 3rd, 2004, 09:55 AM
Panther893's Avatar
Panther893 Panther893 is offline
MostarDesigns.com
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2004
Posts: 808 Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 5 Days 18 h 16 m 55 sec
Reputation Power: 56
Send a message via MSN to Panther893
if you want to make a output query with a dynamic number of table cells, go look at my sniplet of code in my topic titled "a tricky subject" if not please elaborate a little bit more what exactly you want to do........

Reply With Quote
  #6  
Old December 3rd, 2004, 10:03 AM
Bastion Bastion is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 181 Bastion User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 4 h 23 m 47 sec
Reputation Power: 4
I see what you are trying to do. You're trying to create a table with a top header and a side header.

I would not go the route of a rowspan, simply because I've had to fix a lot of cross-browser rowspan issues in the past. Instead I would set up a regular table and the fields that are connected to 1200, but those that should not display 1200, I would find a way to enter a blank space. Possibly by doing an if statement that only displays the number in the first instance.

So it would become:

Monday Tuesday Wednesday ....
-------------------------------------------------------
1200 Soft Int Int
&nbsp; Int Soft Int

1400 Int Soft Soft


It may end up being too messy, but I'd have to know more about the data to come up with a better answer.

Reply With Quote
  #7  
Old December 3rd, 2004, 10:27 AM
FALCONSEYE FALCONSEYE is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 377 FALCONSEYE Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 16 h 57 m 14 sec
Warnings Level: 15
Number of bans: 1
Reputation Power: 0
here is an example.

http://216.15.150.61/test9.cfm

over here, i test for upto 4 counts. none of this is dynamic. see how i divide monday column for 00:20:00 into 2 rows and 00:49 into 4 rows? since my query results will be depending on the date interval and the network the user chooses, i need to make the number of rows dynamic. it will come from something like

<cfquery name="getCount" datasource="Anatolia">
SELECT BreakTime, COUNT(BreakTime) AS BT
FROM DenInt
WHERE BreakDate BETWEEN '#FORM.startDate#'
AND '#FORM.StopDate#'
AND NetworkID = #FORM.selNet#
GROUP BY BreakTime
ORDER BY BreakTime
</cfquery>

so, getCount.BT is the number of rowspan. thanks for the help in advance. Bastion, it should give you an idea in terms of what type of data will be used.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Creating dynamic table but how?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway