Day 015 - A report with an embedded query

Page 115 of the tutorial is the start of lesson 2.6, which covers creating, modifying and testing a report with an embedded query. Embedded queries are not standalone, reuseable entities; they can only be used where they are created. 

I started by creating a new report based on a table:

I then chose a new query as the data source.

I then selected the fields and specified the sort orders as I'd done previously. This time I noticed the very brief appearance of a window that said something about searching for joins. 

When I indicated I wanted breaks in my report, the wizard proposed the sort order fields:

I deselected AccountNum as instructed. 

The tutorial emphasized the importance of the following screen. 

This is where you specify both the field order and the location (block). Options include the start of the document, the page header, any breaks, the page footer, or the end of the document. 

The wizard also offers to perform calculations on numeric fields:

Next I specified the report size including margins and selected a skin to apply a preset style to the report. 

At the very end of the wizard I gave the report a name and title. Interestingly, there's an option to allow users to modify not just the appearance of the data but also the code. 

On completing the wizard I ran the report:

It's worth going to the report definition and looking at the properties - some of the choices made in the wizard can be changed there. You can choose a different data source, decide what to do if there is no report data, add or remove blocks, change the report layout (including multi-column options), change block printing order, and set a background (for instance, you can use a scanned form image to help you position controls). 

I added some code to the Body block:

The code displays debits as negative amounts:

Note that the code isn't dealing with the query data; it's operating on the local variables that are displayed on the report. But that raises a new issue. Although the report now shows negative transfer amounts, the total is still positive. That's because the total is being calculated on the query fields themselves. So there are three sets of data involved in the process:

  • The original database fields
  • The query fields
  • The local variables in the report

The report needs to calculate the total based on the local variables. To change that I brought up the properties for the calculation control (by right-clicking on the control in the report) and changed the linked item from the query field to the report field:

As noted in the tutorial, page breaks can be added to any block via the properties window. 

Groupware

The next lesson is on WinDev's built in security management system, called "groupware". Adding it to an app is easy; choose Workshop | Configure the user groupware. 

I used the mostly-default settings from the tutorial and fired up my app, where I got a login window. WinDev creates a default login of supervisor/supervisor, so I used that. And got this error:

GPWSupervisorMenu object not found.

Hmm. I did a quick search and found several people who had also encountered this problem. One attributed it to having a French version previously installed. But I didn't see any immediate resolution. I'll have another look tomorrow.