1. Sivaprakash BKR
  2. PowerBuilder
  3. Tuesday, 10 January 2023 06:14 AM UTC

Hello

PB 2022 build 1892

Need to export data from a datawindow to three different JSON string.

1.  All deleted rows
2.  All modified rows
3.  All inserted rows

For deleted rows:     dw_1.ExportJSON(Delete!, 1, 0, 1, 5)  Works!

For 2 & 3, there seems to be only one way.  To use

string dwcontrol.ExportJson( {DWBuffer dwbuffer,} boolean changedonly, boolean format )

The above command exports all data that have been either modified or newly inserted.   But I want these two data in two different JSON string, so that proper DML statements could be generated by the server side scripts.

The other way could be to process every row, check the row status and if that matches generate JSON for that row.  But performance wise ExportJSON seems better.  

Any solution?

dw_1.ExportJSON(DWBuffer dwbuffer, RowStatus rowstatus, boolean format) might do the work.  Is that command or similar one available?

Happiness Always
BKR Sivaprakash

 

René Ullrich Accepted Answer Pending Moderation
  1. Tuesday, 10 January 2023 06:20 AM UTC
  2. PowerBuilder
  3. # 1

Hi Sivaprakash,

I don't know a direct way to do that.

But you could filter the data by rowstatus (dw expression functions isrownew() and isrowmodified()) and then use the same function you already use for the deleted rows with primary or filter buffer.

HTH,

René

 

Comment
  1. Sivaprakash BKR
  2. Tuesday, 10 January 2023 08:26 AM UTC
Thanks Rene,

We are playing with those filter conditions..

  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 11 January 2023 18:38 PM UTC
Hi René;

Another way is to use the RowsCopy() method from the primary DC's appropriate buffer over to a DS's primary buffer & then Export the JSON from the DS after each copy operation.

Regards ... Chris
  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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.