Solved

CFTREEITEM question with 2 queries

Posted on 2001-08-03
2
205 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
[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 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
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 …
Suggested Courses

732 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