1. David Vasconcelos
  2. PowerBuilder
  3. Tuesday, 17 December 2019 15:35 PM UTC

is there a way to take a "snapshot" of a datawindow ...syntax and data so it can be saved to database and later retrieve that data and recreate the datawindow?  I have tried a few things but so far failing.

tried - Getfullstate, save that to the db but when I retrieve the blob and do a setfullstate if fails.

 

Accepted Answer
Ricardo Jasso Accepted Answer Pending Moderation
  1. Tuesday, 17 December 2019 17:47 PM UTC
  2. PowerBuilder
  3. # Permalink

David,

You could first try getting the full state into a blob variable and then immediately afterwards setting the full state into another datawindow to check that GetFullState/SetFullState is working properly.

If that works, then you can try base64 encoding the blob using the CoderObject, store it in the dbms as a text, read it back, base64 decode, and set full state.

If that works, then there could be an incompatiblity between the PowerBuilder blob type and the DBMS blob type.

Regards,

Ricardo

Comment
  1. Ricardo Jasso
  2. Tuesday, 17 December 2019 20:57 PM UTC
I was referring to your original intent of saving the blob directly to the database in an image column. I'm sorry for the confusion. It got to me that maybe you were not using updateblob/selectblob in the first place. Also, as Chris mentioned, check that dbparm blob limits are enough. The updateblob/selectblob is not needed if you go the text route. Just make sure the text limits are enough. Remember that encoding to base64 actually increases the necessary bytes to store binary data.
  1. Helpful
  1. David Vasconcelos
  2. Tuesday, 17 December 2019 21:35 PM UTC
Thanks Ricardo, I did up the limit on DBParm just in case, I did not have to do the base64 encoding once I changed the column type to be Image is seemed to all just work... :)
  1. Helpful
  1. Ricardo Jasso
  2. Tuesday, 17 December 2019 21:45 PM UTC
Great! The base64 encoding was just an idea to pinpoint the real cause of the problem which turned out to be the incorrect DBMS datatype used (text instead of image). I'm glad you got it working now.
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Thursday, 12 March 2020 09:07 AM UTC
  2. PowerBuilder
  3. # 1

Sorry for re-opening this:

I've done a GetFullState() / SetFullState() of a dynamically created dw yesterday.

I'm using a CLOB column in an Oracle table.

It's a Grid datawindow with one header with some texts and a row with some columns.

I'm NOT writing anything to disk.

What I'm seeing is that SetFullState() returns -1, even though it DOES work!

That happens when I don't write anything in any of the columns before saving.

The moment I write some text before doing a GetFullState and UPDATEBLOB, everything works without returning -1 when doing the Selectblob and SetFullState().

my 2cts.

I've reported this as a possible bug.

Well ... I've made a small sample application. Funnily enough, I can no longer replicate it myself. Not even with the main application! If I'm able to reproduce the case again (with a sample app), I'll make a new bug. Please close this one and sorry for wasting your time.

regards

Comment
There are no comments made yet.
Christopher Craft Accepted Answer Pending Moderation
  1. Tuesday, 17 December 2019 17:48 PM UTC
  2. PowerBuilder
  3. # 2

David,

We have a reporting feature which saves every report to the database to be viewed later. This is all done using using GetFullState/SetFullState calls without any issue. What problem are you having with this?

Chris Craft

Comment
  1. David Vasconcelos
  2. Tuesday, 17 December 2019 19:01 PM UTC
I must not be doing correctly.. any help would be appreciated... once you have the blob from the getfullstate how are you saving to the DB, any manipulation/encoding (what data type are you using, text, image, ???) when you retrieve from the DB are you doing anything before issuing the Setfullstate. Thanks for the response.
  1. Helpful
  1. Christopher Craft
  2. Wednesday, 18 December 2019 22:35 PM UTC
Sorry for not getting back quick enough but it looks like you got it going. One thing you might need using this technique - SetFullState does not set the DataObject in the DW so you will need to do that if you care about it.
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 17 December 2019 16:00 PM UTC
  2. PowerBuilder
  3. # 3

Hi David;

  Yes, export the DWO into a PSR file and then save that as a Blob in the DBMS. A PSR (PowerSoft Report) format is the DWO source plus all of its buffers.

  To reconstitute, perform a SelectBlob on the PSR file and then assign the PSR to any DW Control (ie:  DC.DataObject = "david.psr".

HTH

Regards ... Chris

Comment
  1. Chris Pollach @Appeon
  2. Tuesday, 17 December 2019 17:16 PM UTC
If your DWO uses external objects - then the PSR needs to find these as well and in the *same* location.

The Heading should be there. Is the Header Band built from another child DWO?
  1. Helpful
  1. David Vasconcelos
  2. Tuesday, 17 December 2019 18:26 PM UTC
No, its a computed field that contains display data.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Tuesday, 17 December 2019 19:15 PM UTC
Have you tried using the GROUPCalc() command after assigning the PSR to force the DWO to re-do the computed fields?
  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.