Solved

CFTREEITEM question with 2 queries

Posted on 2001-08-03
2
200 Views
Last Modified: 2013-12-24


I have 2 queries :

<CFQUERY NAME="Get_div_disc" DATASOURCE="#DSN#">
select distinct(col_colid), col_shortname, col_desc from col_codelist
</CFQUERY>

<CFQUERY NAME="test" DATASOURCE="#DSN#">
select distinct(dv_divisionid), dv_shortname, dv_colid
from dv_divisionlist where dv_colid=#dv#
</CFQUERY>

=== code===

<CFFORM ACTION="cftreeitem.cfm" METHOD="POST" ENABLECAB="Yes">

<CFTREE NAME="Get_div_disc" HEIGHT="250" WIDTH="340"
         FONT="Arial Narrow" BOLD="No"
         ITALIC="No" BORDER="Yes"
         HSCROLL="Yes" VSCROLL="Yes"
         REQUIRED="No" COMPLETEPATH="No"
         APPENDKEY="Yes" HIGHLIGHTHREF="Yes">
<CFLOOP QUERY="Get_div_disc">
  <CFTREEITEM VALUE="#col_shortname#-#col_desc#" PARENT="Get_div_disc" EXPAND="no">
 
 
  <cfset #dv#=#col_colid#>
  <CFQUERY NAME="test" DATASOURCE="#DSN#">
select distinct(dv_divisionid), dv_shortname, dv_colid
from dv_divisionlist where dv_colid=#dv#
</CFQUERY>
    <CFLOOP QUERY="test">
          <CFTREEITEM VALUE="#dv_shortname#" PARENT="Get_div_disc" EXPAND="no">
</CFLOOP>
</CFLOOP>

========= end of code =====

I get

E
EE
ER
F
FE
S
SR
SS

in the same folder level

what I need it

E and inside a the E folder another 2 folders called EE and ER
F and inside a the F folder another folder called FE
S and inside a the S folder another 2 folders called SS and SR

How do I accomplish this?
given that I am unable to use 1 query for output... I have to use 2 queries.


     



0
Comment
Question by:anusha
  • 2
2 Comments
 
LVL 14

Accepted Solution

by:
Scott Bennett earned 200 total points
ID: 6350107
Try this:


-----------------------------------------------------------
<CFFORM ACTION="cftreeitem.cfm" METHOD="POST" ENABLECAB="Yes">

<CFTREE NAME="Get_div_disc" HEIGHT="250" WIDTH="340"
        FONT="Arial Narrow" BOLD="No"
        ITALIC="No" BORDER="Yes"
        HSCROLL="Yes" VSCROLL="Yes"
        REQUIRED="No" COMPLETEPATH="No"
        APPENDKEY="Yes" HIGHLIGHTHREF="Yes">
<CFLOOP QUERY="Get_div_disc">
 <CFTREEITEM VALUE="#col_shortname#-#col_desc#" PARENT="Get_div_disc" EXPAND="no">
 
 
 <cfset #dv#=#col_colid#>
 <CFQUERY NAME="test" DATASOURCE="#DSN#">
select distinct(dv_divisionid), dv_shortname, dv_colid
from dv_divisionlist where dv_colid=#dv#
</CFQUERY>
   <CFLOOP QUERY="test">
         <CFTREEITEM VALUE="#dv_shortname#" PARENT="#col_shortname#-#col_desc#" EXPAND="no">
</CFLOOP>
</CFLOOP>

</CFTREE>

-----------------------------------------------------------

I didn't have time to test it so if you get an error let me know what it is.


-Scott
0
 
LVL 14

Expert Comment

by:Scott Bennett
ID: 6350141
The changes I made to your original code were

1. Added a </cftree> because it wasn't there (at least not in the code you provided)

2. Changed the parent of the subfolders to the name of the parent folder rather then the name of the tree.

-Scott
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
iis reverse proxy virtual directory 8 234
.htaccess rewrite url with querystring problem 13 114
PHP Register global 21 104
Best practices for sharing large amounts of data 9 107
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

713 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