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

Multiple selection from datawindow rows?

3,264 views
Skip to first unread message

Rick

unread,
Feb 25, 2010, 3:21:39 PM2/25/10
to
A window on our PB 11.2 application has a data window. We now have a
new project to allow users to select one or more rows from this
datawindow and then use all values from one column on these selected
rows for another process. I'm not sure how best to permit the
multiple selecting.

I thought of adding a checkbox object to the dw control, but I think a
checkbox object has to be associated with a column in the dw, whereas
this checkbox would just be for selection purposes and I don't think
you could select multiple rows. Then I thought to make a separate
listbox control and populate it from the dw, but I'm not sure
Powerbuilder listboxes allow for multiple selection. Any thoughts
would be appreciated.

rideau

unread,
Feb 25, 2010, 4:21:06 PM2/25/10
to

We had to deal with the exact case just a few months ago. Yes the PB
listbox does allow for multi select. In our case, we ended up
replacing the DW with a listview control (also allows for multi
select, and in addition, allows for more options than listbox
control).

Rick

unread,
Feb 25, 2010, 5:02:22 PM2/25/10
to
Ah, thanks -- I see that listbox and listview controls do allow for
multiple selection.

I guess I was hoping to somehow allow the users to check checkboxes
(rather than just selecting the items in a listview). I just don't
think that you can select multiple rows in a dw, and I can't think how
I could incorporate checkboxes into that even if you could.

Mike Stoffel

unread,
Feb 25, 2010, 5:34:04 PM2/25/10
to
We do this all the time. See help for the SelectRow and associated
datawindow functions. The PFC has a rowselection service you could
look at even if you didn't use the PFC.

You can then use dot notation to get all the selected values from a
single column (or multiple) into an array with a single line of code

The checkbox solution is also very easy to implement. Your SELECT
statement would return a dummy column used for the selection
checkbox. Something like:

SELECT 0 AS Selected
FROM ....

Mike

Jeremy Lakeman

unread,
Feb 25, 2010, 8:57:44 PM2/25/10
to
Yes it would be nice if the datawindow control had a simple setting to
enable single selection / multiselect / extended select. But you can
use the selectrow function to implement this behaviour yourself.

As noted by another reply, the pfc has an example implementation.

Then once the rows are selected, there are a number of ways to find
them and use the values from these rows.

eg;
ll_row = getselectedrow( ...
ll_row = find('isselected()', ...
lsa_values = dw_1.object.column.selected

jjaroska

unread,
Feb 27, 2010, 12:49:28 AM2/27/10
to

the same as dummy column in sql, you could also just use computed
column in sql painter like 0 as 'selected_flag'

Rick

unread,
Mar 1, 2010, 11:45:35 AM3/1/10
to
I've experimented with adding a listbox control with the Multiselect
property turned on, and that works fine.

However, I'd prefer to stick with the dw I have and to implement a
solution using checkboxes, but I'm not sure I'm on the right path. In
the SQL painter, I added a column in the SELECT clause of the dw's SQL
so it now reads:

SELECT col1, col2, col3, 0 AS 'selected_flag'
FROM mytable

which added a new column object in my dw. I then set that col object
as StyleType checkbox. But I'm not sure how to set the Update
Properties of the dw. The actual columns of mytable shouldn't be
updated, but I do want users to be able to check col object
'selected_flag' when the app is running. Could someone push me in the
right direction here? Thanks.

(btw, the solution involving a checkbox object in the dw is a
different idea than the solution involving multiple row selection,
right?)

> column in sql painter like 0 as 'selected_flag'- Hide quoted text -
>
> - Show quoted text -

0 new messages