4D v16

Quick reports - exports

Home

 
4D v16
Quick reports - exports

Quick reports - exports    


 

 

In addition to the manipulations explained in the video, you should note that you can also perform exports using the Export editor.

Normally, for a simple export, we recommend using the Export editor. As soon as you need to synthesize your data or combine it into lists or cross tables, saved in HTML with formatting, then you'll need to use the Quick report editor.

It is important to fully understand and make use of all the possibilities that the Quick report editor provides. This will increase your productivity and avoid wasting time performing processing that 4D does very well itself.

Furthermore, you can completely program the generation of reports based on reports that you have already configured as we did in the video and then generate the corresponding source code (during the "Finalization" phase in the Quick report editor).

The Quick report editor is actually an integrated 4D plug-in that has its own programming language.

Refer to the previous videos (First steps in 4D) and more particularly to the documentation to find out more about how this powerful editor works.

For this video, we're going to learn how to use the Quick report editor.

To change things, we're going to move our database to a Mac.

  • First, we'll exit 4D
  • then we'll copy our first database onto a file exchange
  • and then we'll switch to a Mac.

On the Mac, we'll find the file that we transferred on Windows Exchange which is actually a package whose contents can be displayed.

The contents contain:

  • the structure
  • the data
  • the index files
  • and so on.

To start an application on the Mac, you can drag either the .4dbase file or the .4DB file like you do on Windows.

  • Let's drag the file onto an instance of 4D.
  • On start-up, without any conversion whatsoever taking place, we'll see the window as we programmed it, with the possibility of seeing all the technicians, all the interventions and so on.

The main interest in establishing a database is to store data. For the moment, we have done this by displaying data on screen in a form that was predefined by the programmer.

However, in many cases, your users may want to adapt their data extractions to particular needs not specified in the specifications or on an ad hoc basis.

The Quick report editor quickly meets this need.
You can use it to display data from the current selection, in other words, the results of a previously performed query.

You can open the Quick report editor from the toolbar, or by programming it.

We're going to copy the contents of the "Query" button and insert it into the "Report" button while replacing QUERY with QR REPORT

 QR REPORT([TECHNICIANS];Char(1);True;True;True)


which takes 5 parameters:

  • the table name
  • the document name or we can pass Char(1) so that it displays the standard Quick report editor.

then 3 more parameters that we're going to set to TRUE

  • the first allows hierarchical navigation using relations
  • the second allows for a wizard
  • and the 3rd lets you perform a complementary search in the Quick report editor.

Of course, we're also going to adapt the Technicians table.

  • We click on the Technicians button
  • "All" then on the "Report" button

The screen consists of 4 areas:

  1. The top part with the menu bar, tool bar and a gray rectangle for configuring the columns
  2. The green area where you can choose a table, perform a query, set the report type or open the wizard
  3. The fields column for the selected table
  4. The column for sort orders

To quickly produce a report:

  • Double-click on the names of the fields. They will appear in the upper part.
  • Then choose "Print preview" either using the button or from the File menu (on Mac OS, print previews are automatically done in PDF and on Windows there are in XPS)
  • To change the sort order, drag one or more fields to the sorting area

You'll notice that a subtotal row is displayed in the area for each sort criteria that you add.

In subtotal rows, you can add summary calculations by right-clicking on the intersection where the row and column meet.

To go further using this editor, we're going to change pages and display the list of interventions.

We can perform a search before using the Quick report editor, but we can also do so directly from the editor.

The calculation that we're going to perform concerns the number of interventions made by technicians for a given period. So first we're going to search the interventions for the desired period, for example December 2011:

  • Intervention dates past 1/12/11
  • Intervention dates before 31/12/11
  • Query = > We get 314 records out of 11732.

Now we double-click on "Technician_initials", added to the upper part of the screen, and Object. If we print the form as it now stands, we'll get a list of 314 records for December 2011.

But what we want to get is the number of interventions for each technician.

So first of all we need to:

  • Sort by technician by dragging the "Technicians_initials" field into the sort area. A subtotal line is added to the upper part of the screen, where we can add calculations.
  • We also drag the "Object" field as the 2nd sort criteria, which lets us get the distribution of interventions per technician. A 2nd subtotal is also added.

Printing will give us the same list as before, but sorted by the specific criteria.

Since we have not indicated anything in the subtotal rows, they do not appear on screen.

To count the number of interventions, just right-click on one of the columns in the Technician_Initials subtotal row and choose Count.

When it is printed, this row now appears with the number of interventions per technician: 44 interventions for the same technician.

We can do the same thing for the Object subtotal row and we get 10 training sessions, then 9 and so on for a total of 44 interventions for the technician.

The detail rows don't really concern us. We can right-click on the title of the Detail row to hide it. Only the subtotal rows are printed.

To indicate that the body is hidden, its row is filled in with a gray grid.

During printing, we can see the distribution but since we have hidden the Detail row, we can no longer see which technician and which object go with these values.

To find out, we can just type the # symbol in the subtotal rows.

Let's begin with the technician: we can now see the name of the technician next to the number of interventions.

We can do the same with the object:

  • 1st click
  • 2nd click
  • #

When we print it, we can see that it now corresponds to what we wanted: the number of interventions divided by type of intervention and with the total for each technician.

The Quick report editor is a powerful tool where you can add and modify columns, perform programmed calculations and then send the resulting reports not only to a printer but also, for example, to a disk file.

A system dialog box lets you name your file and choose its location.

We find the export and if we open it with a text editor or a spreadsheet, the information is all there.

 
 

 
PROPERTIES 

Product: 4D
Theme: Quick reports - exports

 
HISTORY 

 
ARTICLE USAGE

Self-training ( 4D v16)