Try this, is this what you needed?
---nimer
<CFSET myquery = QueryNew("AffiliateID,FirstName,LastName,Sponsor") >
<CFSET temp = QueryAddRow(myquery)> <CFSET
QuerySetCell(myquery,"AffiliateID","11112222")>
<CFSET QuerySetCell(myquery,"FirstName","Dave")>
<CFSET QuerySetCell(myquery,"LastName","Phillips")>
<CFSET QuerySetCell(myquery,"Sponsor","")>
<CFSET temp = QueryAddRow(myquery)>
<CFSET QuerySetCell(myquery,"AffiliateID","33334444")>
<CFSET QuerySetCell(myquery,"FirstName","John")>
<CFSET QuerySetCell(myquery,"LastName","Smith")>
<CFSET QuerySetCell(myquery,"Sponsor","11112222")>
<CFSET temp = QueryAddRow(myquery)>
<CFSET QuerySetCell(myquery,"AffiliateID","55556666")>
<CFSET QuerySetCell(myquery,"FirstName","Robert")>
<CFSET QuerySetCell(myquery,"LastName","Thompson")>
<CFSET QuerySetCell(myquery,"Sponsor","11112222")>
<CFSET temp = QueryAddRow(myquery)>
<CFSET QuerySetCell(myquery,"AffiliateID","77778888")>
<CFSET QuerySetCell(myquery,"FirstName","Chris")>
<CFSET QuerySetCell(myquery,"LastName","Jones")>
<CFSET QuerySetCell(myquery,"Sponsor","33334444")>
<CFSET temp = QueryAddRow(myquery)>
<CFSET QuerySetCell(myquery,"AffiliateID","99990000")>
<CFSET QuerySetCell(myquery,"FirstName","Patty")>
<CFSET QuerySetCell(myquery,"LastName","Williams")>
<CFSET QuerySetCell(myquery,"Sponsor","11112223")>
<CFDUMP VAR="#myquery#">
<cfform format="html">
<cftree name="t1" format="flash">
<cfloop query="myQuery">
<cftreeitem display="#firstname# #lastname#"
value="#AffiliateID#" parent="#Sponsor#">
</cfloop>
</cftree>
</cfform>
-----Original Message-----
From: Dave Phillips [mailto:[EMAIL PROTECTED]
Sent: Monday, March 21, 2005 2:35 PM
To: CF-Talk
Subject: RE: Please help with CFTREE
Mike,
Sure, thanks for responding:
Below is the code to create a query of five rows. Here's how they
should end up looking in the resulting tree:
Dave Phillips
--John Smith
--Chris Jones
--Robert Thompson
Patty Williams
I think you can probable follow it. The Sponsor refers back to the
parent AffiliateID.
Here you go...any help I can get is GREATLY appreciated on this. I'm
stumped:
<CFSET myquery = QueryNew("AffiliateID,FirstName,LastName,Sponsor") >
<CFSET temp = QueryAddRow(myquery)> <CFSET
QuerySetCell(myquery,"AffiliateID","11112222")>
<CFSET QuerySetCell(myquery,"FirstName","Dave")>
<CFSET QuerySetCell(myquery,"LastName","Phillips")>
<CFSET QuerySetCell(myquery,"Sponsor","")>
<CFSET temp = QueryAddRow(myquery)>
<CFSET QuerySetCell(myquery,"AffiliateID","33334444")>
<CFSET QuerySetCell(myquery,"FirstName","John")>
<CFSET QuerySetCell(myquery,"LastName","Smith")>
<CFSET QuerySetCell(myquery,"Sponsor","11112222")>
<CFSET temp = QueryAddRow(myquery)>
<CFSET QuerySetCell(myquery,"AffiliateID","55556666")>
<CFSET QuerySetCell(myquery,"FirstName","Robert")>
<CFSET QuerySetCell(myquery,"LastName","Thompson")>
<CFSET QuerySetCell(myquery,"Sponsor","11112222")>
<CFSET temp = QueryAddRow(myquery)>
<CFSET QuerySetCell(myquery,"AffiliateID","77778888")>
<CFSET QuerySetCell(myquery,"FirstName","Chris")>
<CFSET QuerySetCell(myquery,"LastName","Jones")>
<CFSET QuerySetCell(myquery,"Sponsor","33334444")>
<CFSET temp = QueryAddRow(myquery)>
<CFSET QuerySetCell(myquery,"AffiliateID","99990000")>
<CFSET QuerySetCell(myquery,"FirstName","Patty")>
<CFSET QuerySetCell(myquery,"LastName","Williams")>
<CFSET QuerySetCell(myquery,"Sponsor","")>
<CFDUMP VAR="#myquery#">
In case it gets cut off, here's what I'm trying to do:
I have an affiliate database that has a record like this:
affiliateID, affiliateName, sponsor
The sponsor, refers to the affiliate who referred another affiliate. So
if affiliateID 2 was referred by affliate ID 1, then 1 is in the sponsor
field for affiliateID 2, and since affiliateID 1 is not sponsored by
anyone, then their sponsor field is NULL.
What I need to do is show the entire affiliate structure in heirarchical
form...so on the first level of the tree, I have the affiliates who are
not sponsored by ANYONE...then, on the second level, the affiliates
sponsored by people on the first level would be collapsed underneath
their respective sponsor and be able to be expanded.
I think my problem lies in my sql query, but I'm not sure, and I've
changed it so much, rather than post it here, I'll see if someone has a
quick answer and knows how to do it right off. I'm sure it's simple, but
since I've never worked with CFTREE before, I just can't figure it out.
I'm using CFMX 7 and trying to do a FLASH cftree, but at this point,
I'll appreciate code that will work in FLASH or applet or any version of
CF for that matter.
Sincerely,
Dave Phillips
BizBreeze.com
[EMAIL PROTECTED]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:199598
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54