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:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old April 28th, 2008, 05:02 PM
bvaz bvaz is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2007
Posts: 8 bvaz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 52 m 26 sec
Reputation Power: 0
Cfquery to html table with 3 columns

Newbie here --
I have seen how to display 3 output fields into and html table. However, I am wishing to display a single output field into an html table that is multiple columns wide (ex. 3) having dynamic rows depending on the number of fields returned. To site a simple example, an access table contains a record for each month of the year and a date on which the monthly meeting occurred....I would like to display across a 3column table each of those dates,
January 23 Februrary 14 March 14
April 22 May 16 etc.....
Thanks in advance

Reply With Quote
  #2  
Old April 29th, 2008, 06:37 AM
Ebot's Avatar
Ebot Ebot is offline
Meatball Surgeon
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Elbow deep in code
Posts: 1,040 Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)  Folding Points: 10015 Folding Title: Novice Folder
Time spent in forums: 1 Week 3 Days 3 h 37 m 17 sec
Reputation Power: 462
Well, I'm assuming that your query can result in more than 3 row, so then you will have multiple rows of 3.

try this:

Code:
<cfquery name="Company_lookup" datasource="#variables.datasource#">
	SELECT COMPANY FROM COMPANY_LOOKUP ORDER BY COMPANY
</cfquery> 

<cfloop from="1" index="i" to="#Company_lookup.recordcount#" step="3">
	<cfoutput>
		#Company_lookup.company[i]#
		<cfset i=i+1>
		#Company_lookup.company[i]#
		<cfset i=i+1>
		#Company_lookup.company[i]#
	</cfoutput>
	<br />
</cfloop>
__________________
The liver is evil and must be punished!

Reply With Quote
  #3  
Old April 30th, 2008, 08:34 AM
bvaz bvaz is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2007
Posts: 8 bvaz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 52 m 26 sec
Reputation Power: 0
Thanks ebot - have created following code from your suggestion and i get error indicating mdate is not defined, yet a previous page executes properly...cannot see my error..
code modified per your suggestion:
<cfquery name="getBoardMeetings" datasource="glenmore">
SELECT *
FROM GCAtblBoardMeetings
WHERE mdate < Now()
ORDER BY mdate DESC
</cfquery>

<cfmodule template="../templates/headStart.cfm" title="Board Meeting Minutes">

<cfmodule template="../templates/headStop.cfm" title="Board Meeting Minutes" menuid="4">

</cfoutput>
<cfloop from="1" index="i" to="#getBoardMeetings.recordcount#" step="3">
<cfoutput>
#dateFormat(mdate[i],'mmmm d, yyyy')#
<cfset i=i+1>
#dateFormat(mdate[i],'mmmm d, yyyy')#
<cfset i=i+1>
#dateFormat(mdate[i],'mmmm d, yyyy')#
</cfoutput>
<br />
</cfloop>


<cfmodule template="../templates/foot.cfm">
(the templates display properly)
code that is working:
<cfquery name="getBoardMeetings" datasource="glenmore">
SELECT *
FROM GCAtblBoardMeetings
WHERE mdate < Now()
ORDER BY mdate DESC
</cfquery>

<cfmodule template="../templates/headStart.cfm" title="Board Meeting Minutes">

<cfmodule template="../templates/headStop.cfm" title="Board Meeting Minutes" menuid="4">

<ul>
<cfloop query="getBoardMeetings">
<cfoutput>
<li>
<cfif #minutes# NEQ "not posted">
<a href="minutes/#minutes#">#dateFormat(mdate,'mmmm d, yyyy')#</a>
<cfelse>
#dateFormat(mdate,'mmmm d, yyyy')# - Not Yet Available
</cfif>
<cfif #trim(notes)# NEQ "">
<br /><em>#notes#</em>
</cfif>
<br /><br />
</li>
</cfoutput>
</cfloop>
</ul>


<cfmodule template="../templates/foot.cfm">
\\appreciate your help....bob

Reply With Quote
  #4  
Old April 30th, 2008, 12:57 PM
kiteless kiteless is offline
Moderator
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,475 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 17 h 7 m 51 sec
Reputation Power: 42
There is no mdate defined in the variables scope. You need to prefix anything related to the query with the name of the query:


<cfloop from="1" index="i" to="#getBoardMeetings.recordcount#" step="3">
<cfoutput>
#dateFormat(getBoardMeetings.mdate[i],'mmmm d, yyyy')#
<cfset i=i+1>
#dateFormat(getBoardMeetings.mdate[i],'mmmm d, yyyy')#
<cfset i=i+1>
#dateFormat(getBoardMeetings.mdate[i],'mmmm d, yyyy')#
</cfoutput>
<br />
</cfloop>
__________________
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
  #5  
Old April 30th, 2008, 04:37 PM
bvaz bvaz is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2007
Posts: 8 bvaz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 52 m 26 sec
Reputation Power: 0
Kiteless,
Thanks so much...worked like a charm....is it possible for you to point me in the right direction to understand how to establish the variable scope you mention? Thanks in advance ..
Kudos,
Bob

Reply With Quote
  #6  
Old April 30th, 2008, 06:15 PM
kiteless kiteless is offline
Moderator
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,475 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 17 h 7 m 51 sec
Reputation Power: 42
The variables scope is the default ColdFusion scope. You don't have to do anything to create it; like all ColdFusion scopes it is created by the CF engine.

So you can do:

<cfset you = "Bob" />
<cfset variables.me = "Brian" />
<cfset variables['kook'] = "Kim Jong Il" />
<cfdump var="#variables#" />

And see that all three are in the variables scope.

Reply With Quote
  #7  
Old May 1st, 2008, 08:10 AM
bvaz bvaz is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2007
Posts: 8 bvaz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 52 m 26 sec
Reputation Power: 0
Thanks kite - appreciate your help.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Cfquery to html table with 3 columns


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

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

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





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