1. Jason Peck
  2. PowerBuilder
  3. Friday, 31 January 2020 16:15 PM UTC

I have several programs where I switch the dataobject in a datawindow back and forth depending on how the users want to see the data by using the following code example.

dw_main.DataObject = 'd_by_shift'

Then I run a reset and go on my merry way. These are all external datawindows I'm using.

This worked fine in 2017 both in development and runtime. It works fine in 2019 in development. But when I go to run it as an executable runtime, it is not working. I get an -1 as a row number when I attempt to insert new rows.

In trying to figure this out I did notice that if I set a dataobject in the code to something by default, like the above mentioned 'd_by_shift', that that particular dataobject would work, but all the rest of the dataobjects I use for dw_main still fail.

Roland Smith Accepted Answer Pending Moderation
  1. Friday, 31 January 2020 19:29 PM UTC
  2. PowerBuilder
  3. # 1

If you build a single EXE without PBD files, you have to list DataWindow objects without a 'hard reference' in a .PBR file.

Comment
  1. Chris Pollach @Appeon
  2. Friday, 31 January 2020 19:38 PM UTC
FYI: Or ANY dynamically assigned object class(es) for that matter - not just DWO's
  1. Helpful
  1. Roland Smith
  2. Friday, 31 January 2020 21:20 PM UTC
I'm pretty sure the .PBR only supports DataWindow objects and image files. Other objects need to have dummy references added. Local variables in an event or function that is never called is a good way.
  1. Helpful
There are no comments made yet.
Michael Kramer Accepted Answer Pending Moderation
  1. Friday, 31 January 2020 17:16 PM UTC
  2. PowerBuilder
  3. # 2

Hi Jason, I tested in PB 2019 R2 - no problems. See source of my "Replace the DW object" function.

(Sorry, I don't have PB 2019 GA)

// Function (none) of_ReplaceDW( string as_dataObject, string as_dwName )
int status
dw_data.DataObject = as_dataObject
dw_data.Reset( )
status = dw_data.InsertRow(0)

// Log status info to MultiLineEdit on the window
Log("DW = " + as_dwName + ", status: " + string(status))

Suddenly it dawned: DO you have the "dynamically referenced DataWindow objects in a .PBD file?

Dynamically referenced DataWindow objects, window classes, and object classes are ONLY included in your executable when you generate .PBD files.

During development each .PBL file is a superset of the .PBD file.

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.