1. Joel Norby
  2. PowerBuilder
  3. Tuesday, 26 January 2021 17:33 PM UTC

Hi,

 

I'm trying to implement async processing.  I've added Async = 1 to my transaction object and added a comment to the retrieve row event of my inherited datawindow control object.  At execution time, I get the following error on the 8th row(8th time retrievrow is called) every time. 

 

"Only the cancel command is allowed when the rows are pending."

 

based on the error I was thinking Async wasn't actually being enabled.  I tried a using a separate transaction object, checking the Asyc dbparm in the transaction object before retrieve and it looks enabled.  Am I missing something?

 

Thanks!

 

Joel

 

Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 27 January 2021 01:50 AM UTC
  2. PowerBuilder
  3. # 1

I've tried Async also in the past, but having to code the retrieveRow event (just a dummy comment should do the trick) makes things pretty slow.

What we do for one of our datawindows which is very slow, is to use a "shared object".

In this link I attached a small demo app to show how to use it: https://community.appeon.com/index.php/qna/q-a/how-do-i-can-to-use-sqlca-with-threads-sharedobject

Mind that you cannot use a shared object for a datawindow that has global functions in its attributes (or maybe you can if you include all the involved libraries in the library list). So what we did was to use a datastore - being an exact copy of the datawindow but without the global functions - to get the data.

regards

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 26 January 2021 21:04 PM UTC
  2. PowerBuilder
  3. # 2

Hi, Joel -

AFAIK, the Async processing enabled by this DBParm does not facilitate simultaneous (i.e., multi-threaded) retrieval of multiple DataWindows. Others in the Community will correct me if I'm mistaken.

Read the Usage comments in the documentation of the Async DBParm:

https://docs.appeon.com/pb2019r3/connection_reference/ch01s01.html#Async

The documentation paints a pretty clear picture of what Async can be used for.

Regards, John

Comment
  1. Joel Norby
  2. Tuesday, 26 January 2021 21:39 PM UTC
Thanks John,

I did review the documentation but perhaps it didn't sink in. I'm trying to wrap my head around the use case for Async funcionality - especially the benefit if you just add a comment in the retrieverow event and not any code. What does changing to async actually do at that point? Other than triggering the retrieverow event for each row. It seems like even with Async turned on, the Retrive has to finish before something else can be executed - unless you want to call some other code within the retrieverow event.



Thanks!



Joel
  1. Helpful
  1. John Fauss
  2. Tuesday, 26 January 2021 22:03 PM UTC
You're welcome! I hope others will chime in if I'm out in left field on this, as I admittedly have never used it in my 25+ years of slinging PowerScript. Like you, I have LOOKED into using it, and could not translate its use into sufficient benefit to warrant using it in the systems I have worked on.

I think the primary benefit of using Async processing is that it provides the end-user with the ability to cancel a long-running query execution prior to data being returned, or cancel what I call a "runaway" retrieval that brings back much more information than the user wanted or intended. Have something / anything (even a single comment line) in the RetrieveRow event is what gives the developer the "hook" they need to be able to cancel that runaway retrieval if it should occur.
  1. Helpful
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Tuesday, 26 January 2021 20:28 PM UTC
  2. PowerBuilder
  3. # 3

As a stopgap, or perhaps a fix, you could do what Windows does:  open the window and display it, THEN start your retrievals.

The  retrievals, even if done one by one, could populate the DW controls as you described above. Personally, I would not repaint the DW control until the retrieve has finished, as writing to the control line by line is very time consuming.

While this is not a performance boost, it would be a perceived performance boost as things are happening on the window.

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 26 January 2021 18:07 PM UTC
  2. PowerBuilder
  3. # 4

What vendor's database (SQLCA.DBMS = ???) are you connecting to? What version/release/build of PB? Not every RDBMS supports this capability.

Comment
  1. John Fauss
  2. Tuesday, 26 January 2021 18:37 PM UTC
Thanks for the info, Joel. What are your expectations? What are you wanting to accomplish using Async Processing?
  1. Helpful
  1. Joel Norby
  2. Tuesday, 26 January 2021 20:15 PM UTC
We're trying to increase performance with loading one of our screens. The are multiple datawindows retrieved on our screen. At the very least we'd like start retrieving all data windows in parallel when the screen loads, and UI would remain unblocked (no spinner), with data appearing as it returns.
  1. Helpful
  1. Miguel Leeuwe
  2. Thursday, 28 January 2021 15:28 PM UTC


Hi Joel,

I've gained significant performance increase for certain slow datawindows by using a stored procedure as the source.

The select was so complicated, that it was easier to use a stored procedure to:

- First get all the data that was needed and put in a temporary (physical) table. (using Insert into .... SELECT....)

- Then the stored procedure, for all the more complicated things/joins/subselects/functions as columns, we would do only on the result set in that temporary table.

- When finished, we'd truncate the temp table. (no commit)
  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.