Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Database structure for treeview

3 posts in DataWindow Last posting was on 2008-05-27 09:59:20.0Z
Ben Posted on 2008-05-27 05:33:48.0Z
From: "Ben" <ben@yahoo.com>
Newsgroups: sybase.public.powerbuilder.datawindow
Subject: Database structure for treeview
Lines: 34
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <483b9d3c@forums-1-dub>
Date: 26 May 2008 22:33:48 -0700
X-Trace: forums-1-dub 1211866428 10.22.241.152 (26 May 2008 22:33:48 -0700)
X-Original-Trace: 26 May 2008 22:33:48 -0700, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:86959
Article PK: 416216

Hi, can you please help me shed a light on how to build a proper treeview
using the following table structure:

COAid Name TreeLevel ParentID
------------------------------------------------------
4000 Revenue 0 NULL
4010 Rev From Services 1 4000
4011 Design 2 4010
4012 Consultancy 2 4010

4020 Rev From Product Sold 1 4000
4021 Fancy Paper 2 4020


The intended look of the treeview as follows:
TreeLevel 0
TreeLevel 1
TreeLevel 2
TreeLevel Nth

4000 Revenue
4010 Rev From Services
4011 Design
4012 Consultancy
4020 Rev From Product Sold
4021 Fancy Paper


Is it possible to draw this table properly using a treeview? How?

thanks
Ben


Chris Werner Posted on 2008-05-27 07:56:36.0Z
From: "Chris Werner" <cwAT{PleaseNoSpam}f-s.de>
Newsgroups: sybase.public.powerbuilder.datawindow
References: <483b9d3c@forums-1-dub>
Subject: Re: Database structure for treeview
Lines: 64
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <483bbeb4$1@forums-1-dub>
Date: 27 May 2008 00:56:36 -0700
X-Trace: forums-1-dub 1211874996 10.22.241.152 (27 May 2008 00:56:36 -0700)
X-Original-Trace: 27 May 2008 00:56:36 -0700, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:86961
Article PK: 416217

Hi Ben,

I guess yuo are thinking about the treeview datawindow. That isn't
appropriate for dynamic level counts. It's rather kind of a group
style datawindow. If you can give a maximum level count and that's
a rather small number it may be possible (see below). Otherwise you
should have a look on the treeview control.

Lets assume you have a maximum of three levels. Then you need
the table three times in your select:

select t1.COAid t1id , t1.Name t1name,
t2.COAid t2id , t2.Name t2name,
t3.COAid t1id , t3.Name t3name
from revtable t1, revtable t2, revtable t3
where t2.ParentID = t1.COAid
and t3.ParentID = t2.COAid

Then t1id and t1name belong to the first treeview level, t2id and t2name
belong to the secoond treeview level and so on. The revenue is cumulated
from the data for the last level. That's not shown in the select statement
above because you didn't show the table for the revenue.


Chris Werner
f+s software gmbh


"Ben" <ben@yahoo.com> schrieb im Newsbeitrag news:483b9d3c@forums-1-dub...

> Hi, can you please help me shed a light on how to build a proper treeview
> using the following table structure:
>
> COAid Name TreeLevel ParentID
> ------------------------------------------------------
> 4000 Revenue 0 NULL
> 4010 Rev From Services 1 4000
> 4011 Design 2 4010
> 4012 Consultancy 2 4010
>
> 4020 Rev From Product Sold 1 4000
> 4021 Fancy Paper 2 4020
>
>
> The intended look of the treeview as follows:
> TreeLevel 0
> TreeLevel 1
> TreeLevel 2
> TreeLevel Nth
>
> 4000 Revenue
> 4010 Rev From Services
> 4011 Design
> 4012 Consultancy
> 4020 Rev From Product Sold
> 4021 Fancy Paper
>
>
> Is it possible to draw this table properly using a treeview? How?
>
> thanks
> Ben
>


Ben Posted on 2008-05-27 09:59:20.0Z
From: "Ben" <ben@yahoo.com>
Newsgroups: sybase.public.powerbuilder.datawindow
References: <483b9d3c@forums-1-dub> <483bbeb4$1@forums-1-dub>
Subject: Re: Database structure for treeview
Lines: 70
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <483bdb78@forums-1-dub>
Date: 27 May 2008 02:59:20 -0700
X-Trace: forums-1-dub 1211882360 10.22.241.152 (27 May 2008 02:59:20 -0700)
X-Original-Trace: 27 May 2008 02:59:20 -0700, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:86964
Article PK: 416221

Thanks

"Chris Werner" <cwAT{PleaseNoSpam}f-s.de> wrote in message
news:483bbeb4$1@forums-1-dub...
> Hi Ben,
>
> I guess yuo are thinking about the treeview datawindow. That isn't
> appropriate for dynamic level counts. It's rather kind of a group
> style datawindow. If you can give a maximum level count and that's
> a rather small number it may be possible (see below). Otherwise you
> should have a look on the treeview control.
>
> Lets assume you have a maximum of three levels. Then you need
> the table three times in your select:
>
> select t1.COAid t1id , t1.Name t1name,
> t2.COAid t2id , t2.Name t2name,
> t3.COAid t1id , t3.Name t3name
> from revtable t1, revtable t2, revtable t3
> where t2.ParentID = t1.COAid
> and t3.ParentID = t2.COAid
>
> Then t1id and t1name belong to the first treeview level, t2id and t2name
> belong to the secoond treeview level and so on. The revenue is cumulated
> from the data for the last level. That's not shown in the select statement
> above because you didn't show the table for the revenue.
>
>
> Chris Werner
> f+s software gmbh
>
>
> "Ben" <ben@yahoo.com> schrieb im Newsbeitrag news:483b9d3c@forums-1-dub...
>> Hi, can you please help me shed a light on how to build a proper treeview
>> using the following table structure:
>>
>> COAid Name TreeLevel ParentID
>> ------------------------------------------------------
>> 4000 Revenue 0 NULL
>> 4010 Rev From Services 1 4000
>> 4011 Design 2 4010
>> 4012 Consultancy 2 4010
>>
>> 4020 Rev From Product Sold 1 4000
>> 4021 Fancy Paper 2 4020
>>
>>
>> The intended look of the treeview as follows:
>> TreeLevel 0
>> TreeLevel 1
>> TreeLevel 2
>> TreeLevel Nth
>>
>> 4000 Revenue
>> 4010 Rev From Services
>> 4011 Design
>> 4012 Consultancy
>> 4020 Rev From Product Sold
>> 4021 Fancy Paper
>>
>>
>> Is it possible to draw this table properly using a treeview? How?
>>
>> thanks
>> Ben
>>
>
>