views:

216

answers:

3

Hi,

I am currently using powerbuilder 6.5 In my application, i want to make a code where any change in one window should reflet another window.Two windows are using the same table. if we channge in one window it is not reflecting in another window if the other window is opened earlier. what cani do?

+1  A: 

Use the datawindow ShareData method to share the content of the two datawindows (you do mean datawindow when you say table, right?).

BTW, I feel for you, having to use that PB 6.5 dinosaur. OTOH, we've just migrated from PB 10 to shiny new PB 11.5, and it has the worst IDE I have ever used. As a programmer, I'm embarrassed to see such am awful software. Sybase should be ashamed of themselves, releasing such a lousy product.

eran
No i meant table only.Two windows are using different datawindow and for these datawindow it is using same table.So if we change in one window it wont reflect that change in other window if it opened one.
Shalma
Well, this is expected. A datawindow communicates with the DB using the Update and Retrieve methods. If you want a datawindow to be updated as a results of DB change, you have to take care of that yourself. In your case, it's easy - just re-retrieve the other dw after you update the one you're working on (or after you commit, if you use different transactions).
eran
I tried to retrieve the datawindow, but it returns -1 pleaes advice
Shalma
This usually happens when you don't set a valid datawindow as the DataSource, or if you omit the call to SetTransObject. Can you retrieve the other datawindow at any point, or does it always fail?
eran
honestly - coming from the MS world - I find the PB legacy IDE a bit rough to use and prefer the VS IDE - I think with PB12 we will have a much better IDE since it is based on VS2008.
Anders K.
A: 

@ eran

No i meant table only.

Two windows are using different datawindow and for these datawindow it is using same table.

So if we change in one window it wont reflect that change in other window if it opened one.

Shalma
+2  A: 

It might help to know a little more about what you are trying to accomplish. Are both windows open at the same time on a single user's screen? Or is one window available to one user and the second being viewed by a separate user waiting to see the updates?

By themselves, the datawindows won't retrieve automatically on updates to the underlying table. In fact, if you have configured the datawindows properly, the update rules should provide some concurrency protection and will not let the second dw update the same table after the first updates. DataWindow2 will sense there's been a change and will try to prevent clobbering the DataWindow1's changes. But again, this may not be an issue if in your context the second window is read-only.

You could have the first window finish its update then check for the existence of the second window and have it retrieve. Even better, use a non-visual business object as an intermediate handler (and also keep nasty cross-window communication code out of the GUI). When the first window's update is successful have it tell the business object it's done, and the object can then tell the second window to retrieve. But there would need to be more done if your second window is updateable.

Bernard Dy
The problem exists when bBoth windows are opened. If the second window is closed one, and if we opened, we can see the updates. If it is already opened we cant see the updates untill we close and open the window again. I am new in power builder please help me. I tried to retrieve whenever there is one change in the first window but it returns -1.
Shalma
It sounds like your on track, but you need to resolve your Retrieve() = -1 issue. eran suggested potential causes of this error code. Have you looked into it?
Terry