Day 033 - Custom report controls and fiddling around with Reports & Queries

Most reports I've seen (and all I've written) have been read-only. That's what reports are, right? But there are two ways you can make reports interactive in WinDev: links and clickable controls.

The link control

For HTML reports you can add a link control, so that anyone viewing the report in a browser can click on the link. In the example the control is a static link, and it appears that this is the only option. 

Clicking on the ... button brings up this window:

It would be nice if the link could come out of file data, but I haven't found a way to do that in a standard report. 

Clickable controls

Making a report control clickable is as simple as opening the code embed point for the control and adding the appropriate code. Here's the code I used, as instructed by the tutorial.

I ran into two minor issues. One was that the editor trimmed WIN_Customer_Form to just Customer_Form (which still worked just fine). The other was that CustomerID did not show up in the code completion for MySource. Again, the code worked fine. 

The WIN_Customer_Form procedure had been previously modified to accept parameters. It was pretty slick to be able to bring up the form from print preview. 

Running the reports in WLanguage

There are a number of language statements for printing reports, including iPreview and iPrintReport. You can pass various constants to control the print destination. The tutorial provides this tease:

You also have the ability to add source code in order to perform specific processes inside each report block (perform calculations, display a dialog box,...).

It'd be nice to have a little more detail on that! 

Reports and Queries

Reports and Queries is a large module that adds user-defined reporting to your application. Users can also distribute their reports to all other users on the network.

You may not want all of your data visible to end users, so WinDev lets you selectively hide files and/or individual fields from the end-user reporting process. You do this via the Reports and Queries tab in the analysis. 

Any reports you define as part of the application can also be made available to R&Q. But by default, queries cannot be modified, which makes good sense given that the query may be needed for some predefined functionality such as a browse. While not mentioned in the tutorial, I think a naming convention for modifiable queries is in order, so you don't end up using them for some fixed functionality. And in any case this seems like a dangerous road, since two users may each create a report using the same query, and one of the reports could fail when the query is modified to suit the needs of the second report. 

In order for your users to modify reports/queries you have to include that support in the setup program. And the screen has a suitably blunt "caution: huge" warning:

How huge? Try 181 MB. 

When you run the installer you still have the option to omit R&Q, so that 181 MB penalty is avoidable. As well, R&Q can be installed separately at a later date. 

I created the installer and ran it with the R&Q option. But I had trouble running reports. Either they had no data or I saw a security error:

The error detail was as follows:

Error at line 2 of Menu Selection of _Menu.Menu.OPT_Table_and_Chart process.
iPrintReport function called.
Unable to open <C:\Program Files (x86)\Reports\ORDERS.FIC> file.
File found neither on disk, nor in libraries (.WDL) or components (.WDK).
System Error Details:
The system cannot find the file specified.
 (2)
----- Technical Information -----
Project : Reports
WL call:
Process of 'Menu Selection of _Menu.Menu.OPT_Table_and_Chart' (WIN_Menu._Menu.Menu.OPT_Table_and_Chart), line 2, thread 0
'iPrintReport' function, syntax 0
What happened?
Unable to open <C:\Program Files (x86)\Reports\ORDERS.FIC> file.
File found neither on disk, nor in libraries (.WDL) or components (.WDK).
Error code: 70003
Level: fatal error (EL_FATAL)
WD55 error code: 3
System error code: 2
System error message:
The system cannot find the file specified.
Dump of the error of 'WD170HF.DLL' module (17.0.161.3).
Debugging information:
##(IXStream)-Handle=<FFFFFFFF>##
Fonction (21,0)
Additional Information:
EIT_SRCFILE : <C:\Program Files (x86)\Reports\ORDERS.FIC>
EIT_LOGICALTABLENAME : <RPT_TopTenTO50538520>
EIT_PILEWL :
Menu Selection of _Menu.Menu.OPT_Table_and_Chart (WIN_Menu._Menu.Menu.OPT_Table_and_Chart), line 2
EIT_DATEHEURE : 16/07/2012 11:34:21
Help

Perhaps I'd forgotten to include the data files in the setup; whatever the reason, I copied the files manually and was able to run the program. 

But when I ran the reports I didn't see the editing icons as shown in the tutorial. I did see an install of R&Q under C:\Program Files (x86)\Reports and Queries 16, only my application was built in WD 17. So maybe I've got some sort of problem related to having multiple installs.

I played around with all of this for a while and didn't get any resolution, so maybe tomorrow I'll go ahead and uninstall WD16 and the Reports program and try again.Â