PowerBuilder – Watch expressions in Debug

Posted on Tuesday, April 13th, 2010 at 8:20 pm in

There is an easy way to see the contents of a datawindow/datastore while in debug mode – through the use of watch expressions.  Once you are stopped at a breakpoint, say after a retrieve, insert the following watch expression:

The watch window should show a “1” indicating the successful execution of the expression.  Open up the file in excel and you will see the contents of the datawindow including column headers.  Note that the watch is evaluated after each line stepped through in the debugger so you probably will want to remove it after you have obtained the information you want. If you have the file open in Excel and continue debugging, the watch will fail (showing a -1) but otherwise there is no problem.

You can use this technique with any valid powerscript expression including

dwname.getitemstring(1,”mycol”) < make sure row and column designations are correct
dwname.object.datawindow.data < only shows a small chunk of the datawindow data.
gf_myfunc(parm1,parm2) < shows the return value of the function

Beware of out of bounds, null values, and unknown row/column type errors as they can close PB completely and can prevent you from running the debugger again until you clear them out of the Watch tab.

Updated March 2021

You might also be interested in

Top