Is it possible to view the datawindow buffers (and data) in the PowerBuilder debugger?
This post is to share something cool that I learned about PowerBuilder 12.5.NET while researching a question posted on StackOverflow. The entire post from StackOverflow can be found here, the member asked if it was possible to view buffer data while debugging a PowerBuilder application, specifically a PowerBuilder 12.5.NET application. I have been using PowerBuilder since the early ’90’s and my first thought was that it is not possible, so I responded with a workaround for viewing datawindow buffer data that I have used throughout the years. I also posted a link to a developer blog that had a cool trick called “DataStore from Debugger” that cleverly injected the SaveAs function into the debugger.
After posting my response I noticed that the original poster said this was a new feature added in PowerBuilder 12.5.NET. I don’t know how I missed this but I was probably in a hurry like usual. This spiked my curiosity because I have been using PowerBuilder 12.5 and had not noticed this new feature yet.
Here is the question that promoted me to start digging around.
As [sic] this option should be as new feature in PowerBuilder 12.5 .NET, but in Debugger I could not see any data in DataStore object. The object information shows [sic] in Debugger are only “base”, “DataObject” and “FlowDirection”, but nothing more. How to reach to see [sic] the data in DataStore object while debugging?
After some experimentation I was able to learn that the new functionality does exist but it only works for the new WPF datawindow which is available in only a few PowerBuilder Targets that I am aware of. This list might not be complete as it is based on my experimentation so if you notice any mistakes or omissions please leave a comment and I’ll fix this list.
- PowerBuilder 12.5.NET WPF Window Application Target – Supported
- PowerBuilder 12.5.NET .NET Assembly Target – Supported
- PowerBuilder 12.5.NET WCF Service Target – Not Supported
- PowerBuilder 12.5.NET PB Assembly Target – Not Supported
- PowerBuilder 12.5 Classic All Targets – Not Supported
Preview of the new Debugger Feature in PowerBuilder 12.5.NET
Using a bare-bones application, I’ve taken some screen prints to show the cool new debugger functionality. The first image is at a breakpoint immediately after the datawindow retrieve. The datawindow uses a web service data source so that I didn’t need to waste any time slapping in database connectivity code. The web service happens to be a WCF Web Service that was created using PowerBuilder 12.5.NET and is running on IIS 7.5
I am sorry about the poor image quality in this article. I am not sure why, but WordPress did a bad job scaling the images.
This next image shows the actual data in the Primary buffer after expanding the tree item. I also expanded one of the columns that is of type System.DateTime, notice how all of the static methods and properties for the DateTime class are shown.
The next image shows another new feature added to the debugger called the DataWindow Visualizer. You open the new visualizer by clicking on the magnifying glass icon under “dwo”. The visualizer basically shows you the preview of your datawindow with a drop down box automatically added for the various buffers. The Data Buffer drop down was not part of my dataobject design, but rather part of the DataWindow Visualizer tool. The debugger allows you to modify the buffer data the same way you would modify any other variable in debug mode. I was not able to find a way to move data from one buffer to another while in debug mode. I tried dragging a row from the primary buffer into filtered or deleted but nothing happened so I suspect this isn’t possible.
So I added some buttons to the dataobject for “Filter”, “Update”, “Delete”, etc., so that I could see data in the various buffers.
After adding buttons to my dataobject and filtering some of the data I was able to view the filtered data using the debugger! I added a filter expression “Left(catname,1) = ‘A'” and after the filter was activated I could see there were 14 rows in the Primary buffer and 112 in the Filtered buffer. The debugger also shows the current row, the x position and y position and lots of other cool stuff that wasn’t there before.
One last screen print, showing another feature of the debugger (for WPFdatawindows) that I didn’t know about. The new feature is called the WPF Visualizer and is a tree-view display of all the controls that make up your window, and datawindow. The Visualizer is pretty cool and gives you an idea of how Sybase re-designed the new WPF datawindow and what .NET classes they used to make it happen. The tool has three panes, one showing all of the controls, another showing the properties for the selected control and the third pane that shows a visual representation of the single control that is highlighted. The WPF Visualizer is a good learning tool if anything and can help you understand how WPF works.
If you find any other cool aspects of the new PowerBuilder debugger or you find any problems with the information I posted please leave a comment and I will update the post. I have intentions of creating a separate article about the web service datawindow that I used, and how you can use the WCF Web Service to insert, update and delete data. Once you figure it out, it is very easy!