Sharing information – PB Docs 126

Sharing information

The ShareData method allows you to share a result set among
two different DataStores or DataWindow controls. When you share
information, you remove the need to retrieve the same data multiple

The ShareData method shares data retrieved by one DataWindow
control or DataStore (called the primary DataWindow) with another
DataWindow control or DataStore (the secondary DataWindow).

Result set descriptions must match

When you share data, the result set descriptions for the DataWindow
objects must be the same. However, the SELECT statements can be
different. For example, you could use the ShareData method to share
data between DataWindow objects that have the following SELECT statements
(because the result set descriptions are the same):

You can also share data between two DataWindow objects where
the source of one is a database and the source of the other is external.
As long as the lists of columns and their datatypes match, you can
share the data.

What is shared?

When you use the ShareData method, the following information
is shared:

  • Primary buffer

  • Delete buffer

  • Filter buffer

  • Sort order

ShareData does not share the formatting characteristics of
the DataWindow objects. That means you can use ShareData to apply
different presentations to the same result set.

When you alter the result set

If you perform an operation that affects the result set for
either the primary or the secondary DataWindow, the change affects
both of the objects sharing the data. Operations that alter the
buffers or the sort order of the secondary DataWindows are rerouted
to the primary DataWindow. For example, if you call the Update method
for the secondary DataWindow, the update operation is applied to
the primary DataWindow also.

Turning off sharing data

To turn off the sharing of data, you use the ShareDataOff
method. When you call ShareDataOff for a primary DataWindow, any
secondary DataWindows are disassociated and no longer contain data.
When you call ShareDataOff for a secondary DataWindow, that DataWindow
no longer contains data, but the primary DataWindow and other secondary
DataWindows are not affected.

In most cases you do not need to turn off sharing, because
the sharing of data is turned off automatically when a window is
closed and any DataWindow controls (or DataStores) associated with
the window are destroyed.


You cannot share data with a DataWindow object that has the
Crosstab presentation style.

Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x