Hand Coded WinDev Reports

Hand Coded Reports

After my series of Webinars on Reports, for the upcoming wxDevCon, I have had several developers ask about about techniques for Reports in WinDev. Hand coded reports is always one of the top questions, so this is a quick overview of the process to do a hand coded report in WinDev.

First don’t rush to do Hand coded reports! Many of the reports that required hand coding with my previous developing enviroment I have been able to do directly in the Windev. But there are still times when I need to take full control.

I will cover two different types of hand coded reports in this article. The first is a report that is based on a database table, query, data set, etc, but for what ever reason the standard WD logic doesn’t fit.

The first step is to set the reports data source as Programing

Next in the Opening Event of the report do what ever you need to initialize the file access and read the first record, such as:

IF HExecuteSQLQuery(ReportDataSource,MyConnection,hQueryWithoutCorrection+hNoBind,SqlStatement) THEN

The Data Read Event is a special event that controls when the report ends. As long as it returns TRUE, a Detail Band is printed and the cycle continues. When it returns FALSE it triggers the end of the report.  Some code similar to this needs to be in the event.


The Pre-Print Body Event should contain any code you need to populate the controls on the detail band.

The Post-Print Body Event should contain any code you need to print related child bands etc. And then get the next record for the data source initialized in the Opening Event. So at the very least it should contain the following:


After the Post-Print Body Event, the Data Read Event is fired again and the process repeats.

That’s all there is to hand coding a report with a loop through a table. Here is a simple flow chart showing the logic

The other type of report that I occasionally have to create doesn’t involve looping through a table, such as printing a one page dashboard report full of charts or something similar.

For this type of report, the data source is set to “No Data Source”

This will cause the Data Read Event to be fired once. So what ever logic you need to retrieve data, print additional bands etc. can be place there. Just remember it only fires once after that the report completes.

Good news!! Glen Rathke of Soft Design Consulting and have I discussed it, and sometime after the wxDevCon we will be incorporating my report material into his training materials!

[suffusion-the-author display=’author’]

Pete Halsted[suffusion-the-author display=’description’]


One thought on “Hand Coded WinDev Reports

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s