PowerBuilder ‘Gotcha’ – Datawindow datasource values

Posted on Monday, August 30th, 2010 at 8:20 pm in

Let’s say you get a request to add some ‘audit’ capability to your application. By audit I mean there is a need to track changes made to various data elements on a record when they are saved back to the database. This can be done any number of ways but you want to make use of the datawindow ‘datasource’ property via dot notation.

ls_orig = dw_items.object.itemDesc.original[ll_row] // values retrieved from database
ls_new = dw_items.object.itemDesc[ll_row] // current values

Now if the values differ you do whatever you need to do.

You test your code on a few columns in the datawindow, things look good, you check it in, it goes to QA and TA DA – rejected.

The auditor states that some of the changed columns were changed but your audit list/report incorrectly lists them.
Example shows: Original Value: Blue Widget New Value: Blue Widget
The data is correct in the application. The auditor changed the value from Blue Widget to Red Widget.

The problem is the item description field on your datawindow object is populated from a dropdown datawindow. To get the proper value you need to:

ls_describe = "Evaluate('LookUpDisplay(partId)', " + string(ll_row) + ")"
ls_new = dw_items.Describe(ls_describe)
You might also be interested in

Top