Solved

CFTREEITEM question with 2 queries

Posted on 2001-08-03
2
211 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 NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

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

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
What You Need to Know when Searching for a Webhost Provider
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

717 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