Solved

CFTREEITEM question with 2 queries

Posted on 2001-08-03
2
196 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

856 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