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.

How to get selected rows in Powerbuilder

4 posts in DataWindow Last posting was on 2008-11-12 00:38:28.0Z
dpinion Posted on 2008-11-11 17:32:15.0Z
From: dpinion <dpinion@gmail.com>
Newsgroups: sybase.public.powerbuilder.datawindow
Subject: How to get selected rows in Powerbuilder
Date: Tue, 11 Nov 2008 09:32:15 -0800 (PST)
Organization: http://groups.google.com
Lines: 17
Message-ID: <730ae72f-c6b4-40bd-b338-c164ca26dc8b@g17g2000prg.googlegroups.com>
NNTP-Posting-Host: 69.15.6.38
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Trace: posting.google.com 1226424735 5831 127.0.0.1 (11 Nov 2008 17:32:15 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 11 Nov 2008 17:32:15 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: g17g2000prg.googlegroups.com; posting-host=69.15.6.38; posting-account=_reUQQoAAAATMEzWS6seMPxKav-xmzIp
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe)
Path: forums-1-dub!forums-master!newssvr.sybase.com!news-sj-1.sprintlink.net!news-peer1.sprintlink.net!newsfeed.yul.equant.net!news-out.readnews.com!transit4.readnews.com!postnews.google.com!g17g2000prg.googlegroups.com!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:88160
Article PK: 417414

Greetings All,
Using PB 9.0.3. I have a window that has 1 datawindow on it. This
datawindow is being populated with data to serve as a "email" type
system. I need the user to be able to highlight rows and then delete
all rows they chose. So far I have been unsuccessful trying to get
information on the selected rows. I am currently using:

dw_1.Object.Data.Selected

to try to get the information, but am getting the following error:

Error: Non-array expected in ANY variable at line 2 in clicked event
of object cb_1 of w_inboxdel.

string setting
setting = dw_1.Object.Data.Selected
messagebox("Items Selected", setting)


"Jerry Siegel [TeamSybase]" <jNOsSPAMsiegel Posted on 2008-11-11 21:45:30.0Z
From: "Jerry Siegel [TeamSybase]" <jNOsSPAMsiegel@yahoo!.com>
Newsgroups: sybase.public.powerbuilder.datawindow
References: <730ae72f-c6b4-40bd-b338-c164ca26dc8b@g17g2000prg.googlegroups.com>
Subject: Re: How to get selected rows in Powerbuilder
Lines: 26
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4919fcfa$1@forums-1-dub>
Date: 11 Nov 2008 13:45:30 -0800
X-Trace: forums-1-dub 1226439930 10.22.241.152 (11 Nov 2008 13:45:30 -0800)
X-Original-Trace: 11 Nov 2008 13:45:30 -0800, vip152.sybase.com
X-Authenticated-User: TeamSybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:88162
Article PK: 417415

dw_1.Object.Data.Selected will return an array of structures. The
structure's variables correspond to the columns in the datawindow. See
"Syntax for all data from selected rows" in Help (use Index rather than
Find).

"dpinion" <dpinion@gmail.com> wrote in message
news:730ae72f-c6b4-40bd-b338-c164ca26dc8b@g17g2000prg.googlegroups.com...
> Greetings All,
> Using PB 9.0.3. I have a window that has 1 datawindow on it. This
> datawindow is being populated with data to serve as a "email" type
> system. I need the user to be able to highlight rows and then delete
> all rows they chose. So far I have been unsuccessful trying to get
> information on the selected rows. I am currently using:
>
> dw_1.Object.Data.Selected
>
> to try to get the information, but am getting the following error:
>
> Error: Non-array expected in ANY variable at line 2 in clicked event
> of object cb_1 of w_inboxdel.
>
> string setting
> setting = dw_1.Object.Data.Selected
> messagebox("Items Selected", setting)


Jeremy Lakeman Posted on 2008-11-11 23:26:04.0Z
From: Jeremy Lakeman <jeremy.lakeman@gmail.com>
Newsgroups: sybase.public.powerbuilder.datawindow
Subject: Re: How to get selected rows in Powerbuilder
Date: Tue, 11 Nov 2008 15:26:04 -0800 (PST)
Organization: http://groups.google.com
Lines: 46
Message-ID: <c522ca2a-ce91-4b40-ba49-867cf99f7f2b@x16g2000prn.googlegroups.com>
References: <730ae72f-c6b4-40bd-b338-c164ca26dc8b@g17g2000prg.googlegroups.com> <4919fcfa$1@forums-1-dub>
NNTP-Posting-Host: 203.122.242.105
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1226445965 815 127.0.0.1 (11 Nov 2008 23:26:05 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 11 Nov 2008 23:26:05 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: x16g2000prn.googlegroups.com; posting-host=203.122.242.105; posting-account=euaBtgoAAAC_vDxfsxmpMKlBxHaHpmRS
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3,gzip(gfe),gzip(gfe)
X-HTTP-Via: 1.1 fly.essential.com.au:3128 (squid/2.5.STABLE8), 1.0 asp.essential.intranet:3128 (squid/2.5.STABLE8)
Path: forums-1-dub!forums-master!newssvr.sybase.com!news-sj-1.sprintlink.net!news-peer1.sprintlink.net!newsfeed.yul.equant.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp.gblx.net!nlpi057.nbdc.sbc.com!prodigy.net!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!x16g2000prn.googlegroups.com!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:88163
Article PK: 417417

On Nov 12, 7:45 am, "Jerry Siegel [TeamSybase]"

<jNOsSPAMsiegel@yahoo!.com> wrote:
> dw_1.Object.Data.Selected will return an array of structures.

set mode = pedant

Actually this expression does not return an array of structures. It
returns an any variable which the VM can implicitly convert into an
array of structures.

In this case the any variable would contain an array of any. Each
element of that array will contain an array of any. Each element of
that array will contain each column value.

eg for a datawindow with the folowing columns;
col1 char(5)
col2 datetime

and the following rows selected;
"row1", 2008-11-01 12:34
"row2", 2008-11-10 17:00

The value returned by the dot notation expression above would be
equivalent to the following code;
any laa_row1[], laa_row2[], laa_selected[], la_ret

laa_row1[1]="row1"
laa_row1[2]=datetime(2008-11-01, 12:34)

laa_row2[1]="row2"
laa_row2[2]=datetime(2008-11-10, 17:00)

laa_selected[1]=laa_row1
laa_selected[2]=laa_row2

la_ret = laa_selected

return la_ret

If this any value is then assigned to an array of structures or nvo's,
the VM will implicitly create each element and assign each instance
value.

Now, back to the original question. If you want to know the row
numbers that were selected call the GetSelectedRow datawindow function
in a loop.


"Jerry Siegel [TeamSybase]" <jNOsSPAMsiegel Posted on 2008-11-12 00:38:28.0Z
From: "Jerry Siegel [TeamSybase]" <jNOsSPAMsiegel@yahoo!.com>
Newsgroups: sybase.public.powerbuilder.datawindow
References: <730ae72f-c6b4-40bd-b338-c164ca26dc8b@g17g2000prg.googlegroups.com> <4919fcfa$1@forums-1-dub> <c522ca2a-ce91-4b40-ba49-867cf99f7f2b@x16g2000prn.googlegroups.com>
Subject: Re: How to get selected rows in Powerbuilder
Lines: 58
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <491a2584$1@forums-1-dub>
Date: 11 Nov 2008 16:38:28 -0800
X-Trace: forums-1-dub 1226450308 10.22.241.152 (11 Nov 2008 16:38:28 -0800)
X-Original-Trace: 11 Nov 2008 16:38:28 -0800, vip152.sybase.com
X-Authenticated-User: TeamSybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:88165
Article PK: 417421

You forgot to turn off pedant mode - does it still apply going forward or is
it reset at the end of the message?<G>

That is correct, but the magic happens behind the curtain. As with any dot
notation there is overhead in doing all those casts. If you are only going
to need one column value, and there are likely to be a small number of
selected rows it is probably more efficient to loop.

"Jeremy Lakeman" <jeremy.lakeman@gmail.com> wrote in message
news:c522ca2a-ce91-4b40-ba49-867cf99f7f2b@x16g2000prn.googlegroups.com...
On Nov 12, 7:45 am, "Jerry Siegel [TeamSybase]"

<jNOsSPAMsiegel@yahoo!.com> wrote:
> dw_1.Object.Data.Selected will return an array of structures.

set mode = pedant

Actually this expression does not return an array of structures. It
returns an any variable which the VM can implicitly convert into an
array of structures.

In this case the any variable would contain an array of any. Each
element of that array will contain an array of any. Each element of
that array will contain each column value.

eg for a datawindow with the folowing columns;
col1 char(5)
col2 datetime

and the following rows selected;
"row1", 2008-11-01 12:34
"row2", 2008-11-10 17:00

The value returned by the dot notation expression above would be
equivalent to the following code;
any laa_row1[], laa_row2[], laa_selected[], la_ret

laa_row1[1]="row1"
laa_row1[2]=datetime(2008-11-01, 12:34)

laa_row2[1]="row2"
laa_row2[2]=datetime(2008-11-10, 17:00)

laa_selected[1]=laa_row1
laa_selected[2]=laa_row2

la_ret = laa_selected

return la_ret

If this any value is then assigned to an array of structures or nvo's,
the VM will implicitly create each element and assign each instance
value.

Now, back to the original question. If you want to know the row
numbers that were selected call the GetSelectedRow datawindow function
in a loop.