1. Gregory Rusak
  2. PowerBuilder
  3. Wednesday, 11 August 2021 22:56 PM UTC

Hello Appeon people,

It appears that in PowerBuilder 2019 R2, ShareData will return -1 if you share the data back with the original dataobject that shared the data in the first place.

I've put together and attached the exported source code for a Window and Datawindow that will exhibit this behaviour.

On the left,

1. Click the Create Datastore button to create a datastore object and assign the dataobject 'd_sharedata_test'

2. Click the Insert Row to Datastore button to insert a row and set the value of s_column_a to 'A'.

3. Click the ShareData with DataWindow button to share the data and note one row appears with the value 'A'

4. Now edit the datawindow and change the value of s_column_b to 'B'

5. Click the Sharedata back with Datastore button which does an accepttext() and shares the data back with the initial datastore object.

6. Note the messagebox indicating the sharedata has failed.

But on the right,

1. Create the datastore.

2. Insert a row into the datawindow setting the value of s_column_a to 'A'

3. Edit column b and set it to the value 'B', then

4. Click the Sharedata back with Datastore, the messagebox indicates the sharedata was successful.

Why is this happening?

 

Your attention to this is greatly appreciated.

Attachments (1)
John Fauss Accepted Answer Pending Moderation
  1. Thursday, 12 August 2021 14:09 PM UTC
  2. PowerBuilder
  3. # 1

You're welcome! If your question is answered to your satisfaction, would you please mark it as "Resolved"? Thanks!

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Thursday, 12 August 2021 00:57 AM UTC
  2. PowerBuilder
  3. # 2

Hi, Gregory -

It's happening because you've coded an invalid operation.

The Datastore (DS) contains the actual DataWindow data buffers. You share those data buffers with the DataWindow Control DWC, but the buffers are "owned" by the DS. When you make a change in the DWC, the change is actually affecting the data buffers in the DS.

In command button (5), you then try to shared the DWC's data buffers with the DS, but the DWC does not have its own data buffers... it is still using the DS's data buffers. There is no need to try and "share data" back from the DWC to the DS. That sharing of data buffers is still in effect because you have not issued a ShareDataOff command.

HTH, John

Comment
  1. Gregory Rusak
  2. Thursday, 12 August 2021 02:13 AM UTC
Thanks John, I was starting to come to that.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.