Solved

CFTREEITEM question with 2 queries

Posted on 2001-08-03
2
170 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:
SBennett earned 200 total points
Comment Utility
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:SBennett
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now