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.

TreeView with checkbox

2 posts in DataWindow Last posting was on 2009-08-26 21:23:42.0Z
Andreas Posted on 2008-10-15 08:00:55.0Z
From: "Andreas" <abastian@uniplus.de>
Newsgroups: sybase.public.powerbuilder.datawindow
Subject: TreeView with checkbox
Lines: 23
Organization: UNIPLUS
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Windows Mail 6.0.6001.18000
X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6001.18049
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <48f5a337@forums-1-dub>
Date: 15 Oct 2008 01:00:55 -0700
X-Trace: forums-1-dub 1224057655 10.22.241.152 (15 Oct 2008 01:00:55 -0700)
X-Original-Trace: 15 Oct 2008 01:00:55 -0700, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:87982
Article PK: 417239

Hi, my question:
is it possible to make a treeview datawindow with checkboxes in all levels?
at least i'd like to have a DW that work as following:

+ checkbox level_1
+ checkbox level_2 row1
+ checkbox level_2 row2
+ checkbox level_2 row3
+ checkbox_level_3 row1
+ checkbox_level_3 row2
and so on

so, if I select the checkbox in leve_1 I want to select automaticaly all
checkboxes of level_2 and level_3
if I select the checkbox in leve_2 I want to select automaticaly select all
checkboxes of level_3

the same should work if I deselect a checkbox.

thanks for answer.

(I'am working with PB11.5 / Vista)


Chris Fauvel Posted on 2009-08-26 21:23:42.0Z
From: "Chris Fauvel" <Chris.Fauvel@gte.net>
Newsgroups: sybase.public.powerbuilder.datawindow
References: <48f5a337@forums-1-dub>
Subject: Re: TreeView with checkbox
Lines: 238
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4a95a7de$1@forums-1-dub>
Date: 26 Aug 2009 14:23:42 -0700
X-Trace: forums-1-dub 1251321822 10.22.241.152 (26 Aug 2009 14:23:42 -0700)
X-Original-Trace: 26 Aug 2009 14:23:42 -0700, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:89836
Article PK: 419024

I too had a need to do something similar. I think I can help you in this
regard, maybe you can help me with my issue.

Definitions

Client - highest level
region - any value that splits out the entities below
management company - a conglomerate that manages the entities
brand - a manufacturer's various brands
store - a specific retail store location, such as as McDonald's restaurant
on 10 th street , each has a unique ID

I have the following levels

1 - Client
2 - Region
3 - Management Company
4 - brand
store detail (detail band)

example data

1 - Star
2 - West
3 - IHG
4 - Craft
A craft store id = 101
B craft store id = 120
4 - office
C craft store id = 102

4 - N/A //the brand is null in the Db, thus set the value =
'N/A'
D craft store id = 102
E craft store id = 300
X craft store id = 202

2 - East
3 - IHG
4 - Craft
Z craft store id = 999
3 - N/A
4 - Craft
S craft store id = 444
U craft store id = 555



if the user selects a level then an entry in another table needs to be added
stating the level and value that they want.
IE: if they select the brand CRAFT under the Management Company IHG, under
the Region EAST, under the client Star, then the following entries should be
made
Level Value
4 Craft
3 IHG
2 EAST
1 Star
if the user selects one or more detail band stores then the IDs of the
stores are to be palced in the table.
IE:if they select store S and store U, then following entries should be
made.
Level Value
null 444
null 555

if the user did both selections above the table values would be
Level Value
4 Craft
3 IHG
2 EAST
1 Star
null 444
null 555

it would be interpreted as all stores who are under the Star client, East
region, IHG management company, Craft brand OR the specific store of ids in
(444,555)

The problem that I had which I think is similar to what you are trying to do
is, if the level has the value N/A I was lost as to what stores to tag, thus
I decided that if the user clicks on the level that has N/A I will
automatically select the store ids directly below that level.

in the TreeNodeSelected event I capture the level the user selected and test
that the user didn't select a detail band row and build a string to use with
the FIND() method in a user event elsewhere.
Initially I used a filter process, but once you un-filter the rows the view
is colapsed again, and doesn't bring you back to where you were.

ROW in this event seems to be the first row in the detail band that is under
your tree level, so to get the value I needed I made sure the column that
represented the tree level was in the detail band, but invisible.

Level dwo.name
1 valuetrakclient_1
2 region_1
3 mgmtco_1
4 brand_1
detail valuetrackclient, region, mgmtco, brand <-invisible
visible -> operatorid, operator_name, operator_address



//TreeNodeSelected
ll_selectedrow = this.getselectedrow( 0)


If row > 0 then
ls_brand = this.object.brand[row]
ls_mgmtco = this.object.mgmtco[row]
ls_region = this.object.region[row]
ls_valuetrakclient = this.object.valuetrakclient[row]


If ll_selectedrow = 0 and row<> 0 then

Choose case grouplevel
case 4
//brand
if ls_brand = 'N/A' then

ls_filter = 'brand ="'+ ls_brand + '" and mgmtco = "'+ ls_mgmtco + '"
and region = "'+ls_region + '" and valuetrakclient = "' + ls_valuetrakclient
+ '"'

this.event ue_find_and_select(ls_filter, row)
// this.setredraw( False)
// ll_rtc = this.setfilter( ls_filter)
// ll_rtc = this.filter( )
// ll_rtc = this.selectrow( 0, true)
//
// ll_rtc = this.setfilter( blankfilter )
// ll_rtc = this.filter( )
// this.setredraw( true)

END IF

Case 3
//mgmtco
If ls_mgmtco = 'N/A' then

ls_filter = 'mgmtco = "'+ ls_mgmtco + '" and region = "'+ls_region + '"
and valuetrakclient = "' + ls_valuetrakclient + '"'
this.event ue_find_and_select(ls_filter, row)

END IF
case 2
//region
IF ls_region = 'N/A' then
ls_filter = 'region = "'+ls_region + '" and valuetrakclient = "' +
ls_valuetrakclient + '"'

this.event ue_find_and_select(ls_filter, row)


END IF
Case 1
//valutrackclient
if ls_valuetrakclient = 'N/A' then
ls_filter = 'valuetrakclient = "' + ls_valuetrakclient + '"'

this.event ue_find_and_select(ls_filter, row)

END IF

end choose
END IF
End IF


//ue_find_and_select
long ll_foundrow, ll_rowcount
this.selectrow( 0, false)

ll_rowcount = this.rowcount()

ll_foundrow = this.find( as_find , al_startrow ,ll_rowcount)
Do While ll_foundrow <> 0
SetPointer(hourglass!)
this.selectrow( ll_foundrow, true)
ll_foundrow = this.find( as_find , ll_foundrow + 1 ,ll_rowcount)
Loop

SetPointer(ARROW!)


We pass in the ROW parm to the userevent, since the value is the first row
that in under the tree level selected. We loop thru each detail band until
the combination of the various levels are no longer found.
In your case you would leave off these if statements in the treeNodeSelected
event

IF ls_valuetrakclient = 'N/A' then
IF ls_region = 'N/A' then
IF ls_brand = 'N/A' then
IF ls_mgmtco = 'N/A' then



I believe the Filter() approach will still work, because you can "expand"
after the unfilter..


My problem is I don't know how to get the value of the levels outside of the
treeNodeSelected event.

"Andreas" <abastian@uniplus.de> wrote in message
news:48f5a337@forums-1-dub...
> Hi, my question:
> is it possible to make a treeview datawindow with checkboxes in all
> levels?
> at least i'd like to have a DW that work as following:
>
> + checkbox level_1
> + checkbox level_2 row1
> + checkbox level_2 row2
> + checkbox level_2 row3
> + checkbox_level_3 row1
> + checkbox_level_3 row2
> and so on
>
> so, if I select the checkbox in leve_1 I want to select automaticaly all
> checkboxes of level_2 and level_3
> if I select the checkbox in leve_2 I want to select automaticaly select
> all checkboxes of level_3
>
> the same should work if I deselect a checkbox.
>
> thanks for answer.
>
> (I'am working with PB11.5 / Vista)
>