?
Solved

display list of states, with list of projects under each state

Posted on 2014-10-02
2
Medium Priority
?
119 Views
Last Modified: 2014-10-02
ColdFusion 9
MS SQL Server 2012

I should know this, and have done this before, but can't think of the solution right now.

On this page: http://www.doivista.org/oursites.cfm

I need to display a list of states, with a list of projects under each state. Right now, the states are not grouped.

Here's the code, below. Thanks as always. =)

Eric

<cfquery name="getProjects" datasource="#application.datasource#">
SELECT
projectID,
ProjectName,
OSMVISTA,
State,
Archive
FROM #REQUEST.ProjectsTable#
ORDER BY State, ProjectName, Archive
</cfquery>


<!--- Loop through project data records --->
 <cfoutput query="getProjects" group="state">
 
 <cfloop query="getProjects">
<p><strong>#getProjects.State#</strong></p>
<p><a href="/showProjectRecord.cfm?ProjectID=#val(getProjects.ProjectID)#">#getProjects.ProjectName#</a> (OSM/VISTA Volunteer: #getProjects.OSMVISTA#)</p>
</cfloop>

 </cfoutput>

Open in new window

0
Comment
Question by:Eric Bourland
[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
2 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 2000 total points
ID: 40357193
The "State" header should be within the outer loop. Also, use <cfoutput> instead of <cfloop> for the inner loop.  

Untested, but something like this:
<!--- Loop through project data records --->
 <cfoutput query="getProjects" group="state">
     <p><strong>#getProjects.State#</strong></p>
 
      <cfoutput>
         <p>
              <a href="/showProjectRecord.cfm?ProjectID=#val(getProjects.ProjectID)#">#getProjects.ProjectName#</a> (OSM/VISTA Volunteer: #getProjects.OSMVISTA#)
        </p>
     </cfoutput>

 </cfoutput>

Open in new window

0
 
LVL 3

Author Closing Comment

by:Eric Bourland
ID: 40357204
Got it. =)

_agx_, thank you as always. Hope your day is going well.

Take care. =)

Eric
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
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 …
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month9 days, 20 hours left to enroll

762 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