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:
  #1  
Old December 18th, 2005, 02:21 PM
jdh0f0 jdh0f0 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 80 jdh0f0 User rank is Private First Class (20 - 50 Reputation Level)jdh0f0 User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 4 h 20 m 54 sec
Reputation Power: 4
Assign Output to Specific Table Cells

How can I modify the page and hits output line below so that the output is forced into the appropriate table column accoring to the table column headings?

Thanks,
Jason

Code:
<CFQUERY NAME="Usage" DATASOURCE="courses">
SELECT
    count (F05_253_stats_individual.Page) as Hits, 
    F05_253_stats_individual.Page,
    F05_253_stats_individual.SID,
    F05_253_grades.FirstName,
    F05_253_grades.LastName
FROM
    F05_253_stats_individual,
    F05_253_grades
WHERE
    F05_253_grades.SSN = F05_253_stats_individual.SID
GROUP BY
    F05_253_stats_individual.SID,
    F05_253_stats_individual.Page,
    F05_253_grades.FirstName,
    F05_253_grades.LastName
</CFQUERY>

<TABLE BORDER="1" CLASS="smalltext">
<TR>
	<TD>Name</TD>
	<TD>Home</TD>
	<TD>Syllabus</TD>
	<TD>EE Paper</TD>
	<TD>Study Guides</TD>
	<TD>Grades</TD>
	<TD>About Me</TD>
</TR>
<CFOUTPUT QUERY="Usage" GROUP="SID">
<TR>
	<TD><B>#FirstName# #LastName#</B></TD>
<CFOUTPUT>
	<TD>#Page# #Hits#</TD>
</CFOUTPUT>
</TD></TR>
</CFOUTPUT>
</TABLE>

Reply With Quote
  #2  
Old December 18th, 2005, 06:11 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,752 kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 22 h 8 m 4 sec
Reputation Power: 62
I don't understand what you are asking.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old December 18th, 2005, 07:12 PM
jdh0f0 jdh0f0 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 80 jdh0f0 User rank is Private First Class (20 - 50 Reputation Level)jdh0f0 User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 4 h 20 m 54 sec
Reputation Power: 4
The code above produces a table like the one shown here (which just throws the output into table cells left to right with no regard for the corresponding column header):


I want it to do something more like this, where it matches the output with the correct table column:


Thanks,
Jason

Reply With Quote
  #4  
Old December 18th, 2005, 10:09 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,752 kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 22 h 8 m 4 sec
Reputation Power: 62
I'm still not sure I follow (why are there extra columns if there is no data in any of them?), but maybe this article I wrote a while back for Builder will help:

http://builder.com.com/5100-6389_14-5070836.html

Reply With Quote
  #5  
Old December 18th, 2005, 11:06 PM
jdh0f0 jdh0f0 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 80 jdh0f0 User rank is Private First Class (20 - 50 Reputation Level)jdh0f0 User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 4 h 20 m 54 sec
Reputation Power: 4
Quote:
Originally Posted by kiteless
I'm still not sure I follow (why are there extra columns if there is no data in any of them?), but maybe this article I wrote a while back for Builder will help:

http://builder.com.com/5100-6389_14-5070836.html


Yep, that's exactly what I need to do! The tutorial is a bit advanced for me, but I may be able to adapt it to my needs if I knew what the 3 queries should look like. I couldn't find them in the tutorial - am I missing something, or are example queries not provided with that tutorial?

Thanks,
Jason

Reply With Quote
  #6  
Old December 19th, 2005, 09:49 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,752 kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 22 h 8 m 4 sec
Reputation Power: 62
One query contains what equates to the headers, one column contains what equates to the rows, and one has the data itself. So if you know what all possible columns are, and what all possible rows are, then you can individually go into the data query (or a structure holding that data, etc.) and look to see if there is data there.

I agree it is quite advanced and if you are new to CF I would recommend taking a simpler approach until you can generate the display that you really want. It can take some time to get comfortable with manipulating data and queries.

Another option is to attack this from the query side, and ensure that a data value exists for every cell in the table. This usually requires outer joins, and is also rather complex depending on your data schema.

Reply With Quote
  #7  
Old January 3rd, 2006, 11:23 AM
jdh0f0 jdh0f0 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 80 jdh0f0 User rank is Private First Class (20 - 50 Reputation Level)jdh0f0 User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 4 h 20 m 54 sec
Reputation Power: 4
For anyone who comes upon this thread later, here is a fairly strightforward solution that a friend came up with for me:

Code:
<CFQUERY NAME="Usage" DATASOURCE="#request.dsn#">
SELECT count (#request.IndivStats#.Page) as Hits, #request.IndivStats#.Page, #request.IndivStats#.SID, #request.GradeTable#.FirstName, #request.GradeTable#.LastName
FROM #request.IndivStats#, #request.GradeTable#
WHERE #request.GradeTable#.SSN = #request.IndivStats#.SID
GROUP BY #request.IndivStats#.SID, #request.IndivStats#.Page, #request.GradeTable#.FirstName, #request.GradeTable#.LastName
ORDER BY #request.GradeTable#.LastName, #request.GradeTable#.FirstName, #request.IndivStats#.Page
</CFQUERY>

<TABLE WIDTH="650" BORDER="0" CLASS="smalltext" CELLPADDING="3" CELLSPACING="0">
<TR BGCOLOR="445891">
	<TD ALIGN="left"><FONT COLOR="#FFFFFF"><B>Name</B></TD>
	<TD ALIGN="center"><FONT COLOR="#FFFFFF"><B>Home</B></TD>
	<TD ALIGN="center"><FONT COLOR="#FFFFFF"><B>Syllabus</B></TD>
	<TD ALIGN="center"><FONT COLOR="#FFFFFF"><B>Paper</B></TD>
	<TD ALIGN="center"><FONT COLOR="#FFFFFF"><B>Study Guide</B></TD>
	<TD ALIGN="center"><FONT COLOR="#FFFFFF"><B>Grades</B></TD>
	<TD ALIGN="center"><FONT COLOR="#FFFFFF"><B>About Me</B></TD>
	<TD ALIGN="center"><FONT COLOR="#FFFFFF"><B>Unexpected</B></TD>
</TR>
<CFOUTPUT QUERY="Usage" GROUP="SID">
<TR BGCOLOR=###iif(Usage.currentrow MOD 2, DE('C9DAF0'), DE('E9EEF5'))#>
	<TD><B>#LastName#, #FirstName#</B></TD>
<cfset Place_Home = "&nbsp;">
<cfset Place_Syllabus  = "&nbsp;">
<cfset Place_EEPaper  = "&nbsp;">
<cfset Place_StudyGuides  = "&nbsp;">
<cfset Place_Grades  = "&nbsp;">
<cfset Place_AboutMe  = "&nbsp;">
<cfset Place_Unexpected = "&nbsp;">
<CFOUTPUT>
	<cfswitch expression="#Page#">
	<cfcase  value="AboutInstructor"><cfset Place_AboutMe = "#Hits#"></cfcase>
	<cfcase  value="Assignments"><cfset Place_EEPaper = "#Hits#"></cfcase>
	<cfcase  value="grades"><cfset Place_Grades = "#Hits#"></cfcase>
	<cfcase  value="Home"><cfset Place_Home = "#Hits#"></cfcase>
	<cfcase  value="StudyGuides"><cfset Place_StudyGuides = "#Hits#"></cfcase>
	<cfcase  value="Syllabus"><cfset Place_Syllabus = "#Hits#"></cfcase>
	<cfdefaultcase  ><cfset Place_Unexpected = Place_Unexpected & " #Page# #Hits#"></cfdefaultcase>
	</cfswitch>

</CFOUTPUT>
	<TD ALIGN="center">#Place_Home#</TD>
	<TD ALIGN="center">#Place_Syllabus#</TD>
	<TD ALIGN="center">#Place_EEPaper#</TD>
	<TD ALIGN="center">#Place_StudyGuides#</TD>
	<TD ALIGN="center">#Place_Grades#</TD>
	<TD ALIGN="center">#Place_AboutMe#</TD>
	<TD ALIGN="center">#Place_Unexpected#</TD>
	
</TR>
</CFOUTPUT>
</TABLE>

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Assign Output to Specific Table Cells


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 1 hosted by Hostway
Stay green...Green IT