Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TreeView DW Presentation Style Help retrieving Recursively

634 views
Skip to first unread message

raykausae

unread,
Sep 7, 2009, 9:08:30 PM9/7/09
to
Hi,

Seeking assistance populating the TreeView dataWindow
recursively. I’m using PowerBuilder 11.5.1 Build 4011 on
Windows XP SP2. My database has one table containing the
parent ID and the child ID for each record. A parent ID can
point to several child IDs. Each child ID can in turn be a
parent to further child IDs below it. Each child ID can have
one and only parent ID. I’m wondering how I can use the
treeview datawindow to recursively retrieve and present this
structure just like in the normal treeview control. When I
issue a retrieve() the treeview builds the first level
parent-child relationship only but does NOT build the
parent-child structure for lower level child nodes that are
parents to other child nodes.

Thanks very much for your assistance
Ray KAUSAE

Jerry Siegel [TeamSybase]

unread,
Sep 7, 2009, 9:51:19 PM9/7/09
to
That is probably best done in the SQL. Some DBMS, including SQL Anywhere 11
and Oracle support recursive hierarchical queries for such structures as
organization charts and bill of materials.
SQLA example from the help file:
WITH RECURSIVE
manager ( EmployeeID, ManagerID,
GivenName, Surname, mgmt_level ) AS
( ( SELECT EmployeeID, ManagerID, -- initial subquery
GivenName, Surname, 0
FROM Employees AS e
WHERE ManagerID = EmployeeID )
UNION ALL
( SELECT e.EmployeeID, e.ManagerID, -- recursive subquery
e.GivenName, e.Surname, m.mgmt_level + 1
FROM Employees AS e JOIN manager AS m
ON e.ManagerID = m.EmployeeID
AND e.ManagerID <> e.EmployeeID
AND m.mgmt_level < 20 ) )
SELECT * FROM manager
ORDER BY mgmt_level, Surname, GivenName;
--
Report Bugs to Sybase: http://case-express.sybase.com/cx/welcome.do
Product Enhancement Requests:
http://my.isug.com/cgi-bin/1/c/submit_enhancement


<Ray KAUSAE> wrote in message news:4aa5ae8e.6b9...@sybase.com...

Jeremy Lakeman

unread,
Sep 8, 2009, 12:09:57 AM9/8/09
to
I don't think the treeview style really supports that as it has a
limited number of levels in the definition.

raykausae

unread,
Sep 8, 2009, 1:39:20 AM9/8/09
to
Thanks very much. Will try this approach using a stored
procedure.

Many thanks
Ray Kausae

Jerry Siegel [TeamSybase]

unread,
Sep 8, 2009, 4:41:20 PM9/8/09
to
It is true that there a fixed number of levels set at design time. I haven't
tried adding or removing them at run time but I suspect it would be ugly. If
you need the depth to be open ended you may want to use a treeview
*control* - there is an example in the HTML books for populating a treeview
from data in a datastore.


"Jeremy Lakeman" <jeremy....@gmail.com> wrote in message
news:df264646-3aef-46a2...@m20g2000vbp.googlegroups.com...

Jeremy Lakeman

unread,
Sep 8, 2009, 7:59:13 PM9/8/09
to
Or...
A treeview data window is just a couple of images that trigger the
display of rows and bands to be toggled.

You *could* simulate this in a datawindow, retrieving a datastore and
moving the rows as each image is clicked for the first time. Using an
expression for the x property of everything so they move over based on
which level they are on... etc etc.

But a treeview would be much simpler.

On Sep 9, 5:41 am, "Jerry Siegel [TeamSybase]"


<jNOsSPAMsiegel@yahoo!.com> wrote:
> It is true that there a fixed number of levels set at design time. I haven't
> tried adding or removing them at run time but I suspect it would be ugly. If
> you need the depth to be open ended you may want to use a treeview
> *control* - there is an example in the HTML books for populating a treeview
> from data in a datastore.
>
> --
> Report Bugs to Sybase:  http://case-express.sybase.com/cx/welcome.do
> Product Enhancement Requests:http://my.isug.com/cgi-bin/1/c/submit_enhancement
>

> "Jeremy Lakeman" <jeremy.lake...@gmail.com> wrote in message

Jerry Siegel [TeamSybase]

unread,
Sep 8, 2009, 10:46:15 PM9/8/09
to
IIRC the PowerTOOL framework (PB3/4 era, pre-PFC) had a pure PB tab user
object (native didn't arrive until PB5), a dropdown calendar, and a
treeview - done with DWs created on the fly.

"Jeremy Lakeman" <jeremy....@gmail.com> wrote in message

news:6568d079-7d72-4061...@s31g2000yqs.googlegroups.com...

Chris Fauvel

unread,
Sep 10, 2009, 8:47:32 AM9/10/09
to

MSSQL server 2005 also has support for a recursive build of a result
set. if using that DB look at the CTE.

I build my result set from the stored procedure and is displayed in
the treeview DW.

Mine tree looks like
Parent
child 1
grand child 1
child 2
grand child 2
great grand child
grand child 3
child 3
which I think is like you want.

the caveat is that you have to retrieve all the rows first, and you
have to know how deep to go.


A true TreeView could be set up to retrieve just the parents initially
then on whatever the event is called, retrieve the rest of them after
that node..less hit on DB.

Skumar

unread,
Sep 29, 2009, 10:13:02 AM9/29/09
to
Hello Chris Fauvel,

It would be very helpful for me if you could post the SQL and explain
how the groups were set in TreeView Datawindow. I have a similar
situation and struggling to find the solution.

Thanks in advance.

0 new messages