1. Konstantin Goldobin
  2. PowerBuilder
  3. Friday, 26 April 2024 10:45 AM UTC


I started noticing quite some time ago (maybe in PB 12.5, maybe earlier) that PB stopped throwing an error when GetItemX datawindow method is called with row 0. Now, when it happened again in PB2019 R3, I decided to isolate the issue. I created a simple DW with an external data source, one string column "s", and data "ABC". I placed a DW control on a window, and wrote the following datawindow control clicked event script:

messageBox( 'Data in clicked', getItemString( 0, 's'))

When I run the window and click the DW, I get a nice message box:

If I misspell the column name, however:

messageBox( 'Data in clicked', getItemString( 1, 'sss'))

I still get the good old Invalid DW row/column specified error:

Of course, if both row and column are correct, I get "ABC":

messageBox( 'Data in clicked', getItemString( 1, 's'))

Does anybody know why this is happening?

Best regards,

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 26 April 2024 14:00 PM UTC
  2. PowerBuilder
  3. # 1

Hi Konstantin ;

  In the case of the invalid or "out f range" row number, the DWC's GetItemString() only cares about the column data type check. If the column is correct & the row does not exist, the method returns a NULL. It's up to your PB App to use an ISNULL() check on the returned datum. That is how it has originally designed may back in PB 1.0.

Regards .. Chris

  1. Benjamin Gaesslein
  2. Monday, 29 April 2024 08:42 AM UTC
The help entry of GetItemString states that it 'Returns the empty string (" ") if there is no DataWindow object assigned to the DataWindow control or DataStore or if any other error occurs.' so checking for NULL is not indicated here. It seems impossible to infer wether there's an actual space in a column or if the " " is the result of an error.

Error behavior for strings is inconsistent with the other GetItem... functions. GetItemNumber does return NULL when no Dataobject is set and triggers a SystemError AND returns -1 for other errors, same with GetItemDecimal.
  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.