Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

COLDFUSION DRILL DOWN REPORT

Posted on 2008-06-20
5
Medium Priority
?
519 Views
Last Modified: 2013-12-20
I need to know how to create a report to generate a drill down in coldfusion.

Example:

LAST_NAME | FIRST_NAME  
JORDAN         MICHAEL
CRUISE           TONY

Click on Last Name and then it drills down to the next level of data which per say consist of address information.

How can I do this in Coldfusion?

Thank
0
Comment
Question by:jseaman12
[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
  • 2
5 Comments
 
LVL 19

Expert Comment

by:erikTsomik
ID: 21836205
Well first you need a query to pull people names
<cfquery name="people" datasource="#name#">
  select last_name,first_name, emloyeeid from employee
</cfquery>
Now you can start outputing the data
<table border="1">
   <tr>
         <td>Last Name</td>
          <td>First_name</td>
    <td>
</tr>

<cfoutput query="people">
     <tr>
                <td><a href="people_detail.cfm?employee=#employeeID#">#Last_name#</a></td>
                <td>#First_name#</td>
    </tr>
</cfoutput>
</table>


And noe you can go to the processng page

<cfif isDefined("url.employee")>
<cfquery name="peopleDetail" datasource="#name#">
  select phone,email,address from employee where employeeid=#url.employee#
</cfquery>

<table border="1">
   <tr>
         <td> phone </td>
          <td>email</td>
        <td>address</td>
   
</tr>

<cfoutput query="peopleDetail">
     <tr>
                <td>#phone#</td>
                <td>#email#</td>
                <td>#address#</td>
    </tr>
</cfoutput>
</table>
</cfif>


OK the logic here is correct if you have more question please post more . but thata should work for you
0
 
LVL 6

Expert Comment

by:psychic_zero
ID: 21836214
My idea is like this code below. But I'm not sure how to retrieve data from previous page using URL get method in Coldfusion as last time I'm using Coldfusion is about 5 years ago, but hope this can give you some idea.
// 1st Page
 
<CFQUERY DATASOURCE = "users" NAME = "MAIN">
SELECT user_id, first_name, last_name
FROM users
ORDER BY last_name
</CFQUERY> 
 
<table border = "1">
<tr>
   <td>LAST_NAME</td>
   <td>FIRST_NAME</td>
</tr>
<tr>
   <CFOUTPUT QUERY = "MAIN"> 
   <td><a href="detail.cfm?user_id=#user_id#">#first_name#</a></td>
   <td>#last_name#</td>
   </CFOUTPUT> 
</tr>
</table> 
 
// 2nd Page - detail.cfm
// Get the user_id parameter from the previous page
 
<CFQUERY DATASOURCE = "users" NAME = "MAIN">
SELECT user_id, first_name, last_name, address1, address2, state, zipcode
FROM users
WHERE user_id=#user_id#
</CFQUERY> 
 
<table border = "1">
<tr>
   <td>LAST_NAME</td>
   <td>#last_name#</td>
</tr>
<tr>
   <td>FIRST_NAME</td>
   <td>#first_name#</td>
</tr>
<tr>
   <td>ADDRESS 1</td>
   <td>#address1#</td>
</tr>
<tr>
   <td>ADDRESS 2</td>
   <td>#address2#</td>
</tr>
<tr>
   <td>STATE</td>
   <td>#state#</td>
</tr>
<tr>
   <td>ZIP CODE</td>
   <td>#zipcode#</td>
</tr>
</table> 

Open in new window

0
 
LVL 19

Expert Comment

by:erikTsomik
ID: 21836312
psychic_zero:
you sample is identical as mine
0
 
LVL 6

Expert Comment

by:psychic_zero
ID: 21836320
Yeah, the different is I forgot how to retrieve data from previous page in Coldfusion
0
 
LVL 39

Accepted Solution

by:
gdemaria earned 2000 total points
ID: 21838010
To get a variable passed via a URL parameter, use the URL scope  url.user_id
so in your example, it would become

// 2nd Page - detail.cfm
// Get the user_id parameter from the previous page
<cfparam name="url.user_id" default="">

<CFQUERY DATASOURCE = "users" NAME = "MAIN">
SELECT user_id, first_name, last_name, address1, address2, state, zipcode
FROM users
WHERE user_id=#val(url.user_id)#
</CFQUERY>


If the variable comes from a form post, use the form scope as in form.user_id

is that what you were asking?


You are passing it correctly here...
<a href="detail.cfm?user_id=#user_id#">#first_name#</a>

0

Featured Post

Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…
Suggested Courses

609 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