1. David Pylatuk
  2. PowerBuilder
  3. Wednesday, 20 March 2024 14:12 PM UTC

Hello all,

 

I would like to bypass the default update for a datawindow when calling PFC_Update.

 

I understand that sqlpreview essentially intercepts sql including 'inserts' before they are executed against the datawindow. I want to perform my own actions (an insert in this case) with custom logic and never trigger an insert on the table selected in the update properties of the datawindow.

 

Can anyone provide some guidance or ideas on how to do this?

 

Thank you.

 

 

Ronnie Po Accepted Answer Pending Moderation
  1. Wednesday, 20 March 2024 17:33 PM UTC
  2. PowerBuilder
  3. # 1

Hi David,

I would try overriding the pfc_update() event of the DW control. Insert your own embedded SQL in that event, and return 1 if the update succeeds and -1 if it fails (assuming you are allowing the pfc to handle your transaction processing).

 

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 20 March 2024 14:39 PM UTC
  2. PowerBuilder
  3. # 2

Hi, David -

The statements in your question are confusing. SQLPreview is a DataWindow control's (DWC's) event that is triggered as a result of the DWC's Update method, not "before they [the SQL statements] are executed against the DataWindow". The DW already contains the new data that WILL be inserted into the database table, and SQLPreview lets you inspect the SQL statements before they are sent to the database, modify them or have them skipped (not sent to the database).

It's difficult to advise you without a clearer understanding of what you are needing to accomplish. Could you please provide an overview with enough details so that myself and others can advise you properly?

Best regards, John

Comment
There are no comments made yet.
David Pylatuk Accepted Answer Pending Moderation
  1. Wednesday, 20 March 2024 16:25 PM UTC
  2. PowerBuilder
  3. # 3

Hi John, thanks for replying.

I have a legacy app that makes fairly extensive use of sqlpreview. We are migrating this application to PB2022 R3 for deployment to PowerServer. This version of PowerBuilder does not fully support sqlpreview, just the select portion of it.

I am trying to figure out how to modify our application so I can intercept the update statement and perform my own processing with data that is sitting in the dw control. Not really sure where to start or how to do this. I am very familiar with PB but not PFC or sqlpreview.

Any advice would be appreciated, thank you.

Comment
  1. Chris Pollach @Appeon
  2. Wednesday, 20 March 2024 16:30 PM UTC
Hi David;

FYI: the SQLPreview event is targeted to be *fully* supported in the PB / PS 2025 release.

Regards ... Chris
  1. Helpful
  1. John Fauss
  2. Wednesday, 20 March 2024 17:42 PM UTC
@David - I agree with Ronnie's suggested approach.
  1. Helpful
There are no comments made yet.
David Pylatuk Accepted Answer Pending Moderation
  1. Wednesday, 20 March 2024 16:35 PM UTC
  2. PowerBuilder
  3. # 4

Understood, thanks Chris.

Comment
There are no comments made yet.
David Pylatuk Accepted Answer Pending Moderation
  1. Wednesday, 20 March 2024 19:36 PM UTC
  2. PowerBuilder
  3. # 5

Thanks for replying,

 

So essentially overwrite the pfc_update and depending on the action that was going to take place write my own insert or update code?

 

Comment
  1. Ronnie Po
  2. Wednesday, 20 March 2024 20:02 PM UTC
Yes, that is correct, and be sure to "override" the event rather than "extend" it.
  1. Helpful 2
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.