1. Joe Hess II
  2. PowerBuilder
  3. Wednesday, 5 February 2020 18:02 PM UTC

I'm accessing an NVO method that accepts a datawindow as an argument. The NVO uses DESCRIBE to retrieve the select statement. I tried to use a datawindow variable instead of dropping a datawindow control onto the window. However, Describe("datawindow.table.select") returns an empty string when I use the variable. Can someone explain why? The variable works fine communicating with the database.

 

 

Thanks

Joe Hess

 

Accepted Answer
Michael Kramer Accepted Answer Pending Moderation
  1. Thursday, 6 February 2020 09:24 AM UTC
  2. PowerBuilder
  3. # Permalink

Ah! Gotcha!

Your code will work with DataStore, not with DataWindow. Issue is the CREATE statement which creates a PB object without its visual control - and that is a no-can-do.

PB 5 introduced DataStore to leverage DataWindow objects without placing them in DataWindow controls on hidden Windows.

Note: Using variable to refer to DW control is no problem. Example:

DataWindow idw_tax

// Assign DW variable to existing DW control
idw_tax = w_Main.tab_1.tabpage_Company.dw_4

// Use variable reference
string ls_select
ls_select = idw_tax.Describe("DataWindow.Table.SQLSelect")

HTH /Michael

 

Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Friday, 7 February 2020 00:53 AM UTC
  2. PowerBuilder
  3. # 1

Joe -

   If you have access to the NVO source code, just change the datatype fro DW to DS; or if you are using the PFC from U_DW to N_DS.


Later -

Olan

Comment
There are no comments made yet.
Joe Hess II Accepted Answer Pending Moderation
  1. Wednesday, 5 February 2020 22:37 PM UTC
  2. PowerBuilder
  3. # 2

Thanks for the quick response.

 

The datawindow variable is just used to retrieve tax information from a table. The statement is a simple select from a single table. I'm using a datawindow instead of a datastore because the parameter in the NVO is of type datawindow.

 

I have an instance variable

DATAWINDOW idw_tax

 

I instantiate it

idw_tax = CREATE datawindow

idw_tax.DataObject = 'd_salestax'

idw_tax.SetTransObject (SQLCA)

 

idw_tax.GetSQLSelect() returns nothing, idw_tax.Describe("datawindow.table.select") returns nothing. If I change the variable type to a datastore, the select statement is returned by both.

 

This is PB2019, Build 2082.

 

Comment
There are no comments made yet.
Michael Kramer Accepted Answer Pending Moderation
  1. Wednesday, 5 February 2020 18:14 PM UTC
  2. PowerBuilder
  3. # 3

Edit: Added check for "stored procedure".

Your "variable" DataWindow - is it an external DW using ShareData to provide a "secondary" look into data actually residing in a different DataWindow's buffer?

What happens if you call GetSQLSelect( ) or GetSQLPreview( )?

What is value of Describe("DataWindow.Table.Procedure")?

  • DataWindow.Table.SQLSelect has value when DW uses SELECT statement
  • DataWindow.Table.Procedure has value when DW uses stored procedure

HTH /Michael

Comment
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.