The columns must be the same for the DataWindow objects in the primary and secondary DataWindow controls, but the SELECT statements may be different. For example, you could share data between DataWindow objects with these SELECT statements:
SELECT dept_id from dept
SELECT dept_id from dept where dept_id = 200
SELECT dept_id from employee
WHERE clause in secondary has no effect The WHERE clause in the DataWindow object in the secondary DataWindow control has no effect on the number of rows returned. The number of rows returned to both DataWindow controls is determined by the WHERE clause in the primary DataWindow object.
You could also share data with a DataWindow object that has a script data source and a column defined to be like the dept_id column.
To share data between a primary DataWindow and more than one secondary DataWindow control, call ShareData for each secondary DataWindow control.
To turn off sharing in a primary or secondary DataWindow, call the ShareDataOff function. When sharing is turned off for the primary DataWindow, the secondary DataWindows are disconnected and the data disappears. However, turning off sharing for a secondary DataWindow does not affect the data in the primary DataWindow or other secondary DataWindows.
When you call functions in either the primary or secondary DataWindow that change the data, PowerBuilder applies them to the primary DataWindow control and all secondary DataWindow controls are affected. For example, when you call any of the following functions for a secondary DataWindow control, PowerBuilder applies it to the primary DataWindow. Therefore, all messages normally associated with the function go to the primary DataWindow control. Such functions include:
Computed fields in secondary DataWindow controls A secondary DataWindow control can only have data which is in the primary DataWindow control. If you add a computed field to a secondary control, it will not display when you run the application unless you also add it to the primary control.
Query mode and secondary DataWindows When you are sharing data, you cannot turn on query mode for a secondary DataWindow. Trying to set the QueryMode or QuerySort properties results in an error.
To share data between a DataStore or DataWindow and a RichTextEdit control, use the DataSource function.
Crosstab DataWindows You cannot use ShareData with Crosstab DataWindows.
Distributed applications You cannot share data between a DataWindow control in a client application and a DataStore in a server application.