Alventis supports printing via the use of Reports. In general, Reports provide a means of arranging and laying out collections of records, and sending thus merged result into the Report Output. The latter is nothing more than an Alventis Memo that allows you to print its contents or simply save it electronically for future reference. This is all very sweet and even true, but probably not very clear, so let us show you what we mean on a very simple example.

 

Let's say we have records that go something like this:

 

ID

FName

LName

Tel

 

25

John

Doe

123-555-6148

 

26

James

Smith

321-555-6644

 

27

Tom

Brown

147-555-7766

 

We will use a Report Template (we'll show you the real templates later, this is just an example) that could look like this:

User ID: [ID]  Full Name: [FName] [LName]  Tel: [Tel]

 

As you may have guessed, the above tells Alventis how to arrange the values of the records to produce the Report Output, which in our case would resemble:


User ID: 25  Full Name: John Doe

Tel: 123-555-6148


User ID: 26  Full Name: James Smith

Tel: 321-555-6644


User ID: 27  Full Name: Tom Brown

Tel: 147-555-7766

 

Conceptually, what we've just demonstrated using this rather abstract example is precisely what goes on when you generate a Report. The essential steps one would go through to produce some useful Report Output are then:

 

Get the Data. That is, start out with the data that will go into the Report. This corresponds to the 3 records we had in the example above. We'll see where the real data will be coming from in a little while.

 

Arrange the Data. This is something we have not done in our simplistic example. We are talking about operations like sorting and grouping, but we'll examine them in more detail later.

 

Create the Template. This would roughly correspond to that single line "User ID: [ID]...". The real Report Templates are a bit more interesting than that.

 

Produce Report. That's just the name of the button you'd hit at this point.

 

Essentially, that's all there is to it! We will now examine each of the above steps in detail. To avoid too many "forward references" to material we haven't covered yet, we won't go over the Report form in a strict top-to-bottom order. Instead, we'll try to go through it in the most logical fashion: according to the steps in Report preparation that we have outlined above. To get at least some (relatively insignificant) part of the Report form out of our way, we'll just point out that the group of Text Boxes in the top/left area of the form should be mostly familiar to you by now, so we won't bother with them.

 

 

Report1C

 

Getting the Data. As we have mentioned before, every Report is based on a Select query. The ID number of the query is listed in the Text Box called Query close to the top/left corner of the Report form. You can click the little arrow button in it to open the query in its own Query form. The role of the query is to produce an output in the shape of a collection of records. It is this collection of records that the Report will "use", i.e., take as its input, arrange the way you want, and eventually send to the Report Output. These records appear in the Record List grid (which in many ways resembles the Query Output grid).

 

We have seen in the chapter on Queries that a query may have parameters. These parameters are listed in the Report Parameters grid. This little grid works exactly like its counterpart in the Query form. You assign the value you want to a parameter (if there are any) and update the Record List by re-running the query (the Re-run Query toolbar button accomplishes just that). This too is quite similar to what goes on in the Query form. The similarity goes even further: you can open a record in its own InfoView directly from the Record List if you like.

 

The Record List grid is obviously extremely important for the Report since this is what supplies the Report with the data. Its importance doesn't end there though. The Record List grid also represents the entire outline of the Report. This is what we were hinting at when we said earlier "Arrange the Data". Here's what this means:

 

Whatever records appear in the Record List grid will eventually end up in the Report Output. The implication of this is that no matter what cunning tricks you use to make certain records appear or disappear from the Record List, what ends up in the List is what ends up in the Output. The "tricks" you may use can be:

Modifying the query itself that the Report is based on
Adjusting the query parameters, if any
Filtering the records directly in the Record List grid
A combination of any of the above

 

You therefore have practically unlimited control over what data goes into the Report. The what is probably the most important issue and we have just established how you could control it, but there remains the how aspect of the Report.

 

How the Record List gets processed depends first and foremost on two aspects: Grouping and Sorting.

 

Grouping records in the Record List grid is performed exactly as you would do it in any grid in Alventis. The records in the grid become grouped by whatever column (i.e., field) you want. You can have as many grouping levels as you like, of course. The only thing that is special about the Record List grouping is that it directly affects the Report Template (that we will be examining shortly) and eventually the Report Output. As soon as you group by a certain field, the Template receives a pair of new Bands (or sections) that correspond to the grouping field: a Header and a Footer. We'll discuss Template Bands in more detail later. For now, it is sufficient to know that all grouping in the Record List grid directly "translates" into grouping of the Report Template and thus Output.

 

Sorting is similar: you perform it like you would for any grid, and most importantly, it has direct effect on how the records end up sorted in the Report.

 

To sum it up: take whatever records happen to be displayed in the Record List grid, and group and sort them any way you like. The results you see in the grid may not look anything like a Report but they exactly correspond to the structural outline the "real" Report will have.

 

 

Report Template. This is the focal point of the Report. You can think of it as a funnel through which we squeeze all the data that appears in the Record List grid, which squeezes out onto the canvas of the Report Output. Sounds fancy, but it's quite simple in reality.

 

Report1E

 

The Template is nothing more than a Memo which is divided into one or more Bands. Each Band looks and acts very much like a cell of a Memo Table in that it can hold whatever you want to place there: formatted text, bulleted/numbered lists, pictures, tables with more of the above, etc.

 

The simplest imaginable Report that would use no grouping would have the most minimalist Template with a single Band: Detail. The Detail Band corresponds to records in the Record List. Remember our abstract example where we used a line "User ID: [ID]  Full Name: [FName] [LName]  Tel: [Tel]" to produce some formatted output? This is precisely the kind of stuff we want in our Detail Band of the Template. As a matter of fact, this is what we want! Except that we can do better than write the field names by hand enclosing them in clumsy brackets. We can put the Fields themselves in the Template. This is what the Field Grid is for. It simply lists all Fields produced by the query they also match the columns displayed by the Record List grid. The Field grid lists a few more things, but we'll get to them later. To add a Field to a Band of the Template, you simply drag-and-drop it from the Field grid into the Template wherever you find suitable. To reproduce our example report, we would then:

Type "User ID: " in the Detail Band
Drag the ID Field from the Field grid and drop it right after the text we just entered.

 

The Field is created with a little border around it to help us distinguish Fields from other formatted text.

Similarly, we could now add some more text and drag the remaining Fields (FName, LName, Tel or whatever else we may want) where they belong.

 

Report1D

 

Guess what: that's it! You have just created a real, albeit simple, Report. Well, at least the Template for one, but the really important stuff is all done. All that remains is to click the Produce Report button and contemplate the results in the Report Output Memo (see the snapshot before the last one).

 

 

Report Grouping. We have already learned above that any grouping you perform in the Record List grid gets "applied" to the Report Template. Let's examine this in more detail.

 

To demonstrate grouping, we need some data we can sensibly group by some column/field. Let's just group our good old Contacts table by Category of contact: Family/Friend/Coworker. The data itself may look like this:


ID

FName

LName

Tel

Category


25

John

Doe

123-555-6148

Friend


26

James

Smith

321-555-6644

Family


27

Tom

Brown

147-555-7766

Friend


28

Jane

Smith

441-555-6144

Family


29

Bill

White

661-555-3316

Coworker

 

When grouped by Category, the above data will look like:


ID

FName

LName

Tel


Category: Family


26

James

Smith

321-555-6644


28

Jane

Smith

441-555-6144


Category: Friend


25

John

Doe

123-555-6148


27

Tom

Brown

147-555-7766


Category: Coworker


29

Bill

White

661-555-3316

 

Something happened when we grouped the records in the Record List grid: two new Bands appeared in the Template: Group Header: Category and Group Footer: Category one on each side of the Detail Band:

 

Report1G

 

Let's arrange the new 3-Band Template in the following fashion and see what it produces. Let's put the Category Field in the Group Header: Category Band and leave the Group Footer: Category Band empty for the time being. Let's put the relevant record fields in the Detail Band. This would be our usual ID, FName, LName, Tel. Click Produce Report and we obtain the output that essentially corresponds to the way the grouped Record List grid looked like. We have just effortlessly produced a Grouped Report. And how are you doing on your side?

 

You can create as many grouping levels as you want. Simply group the data in the Record List grid, place the relevant Fields in the relevant Group Header/Footer Bands and you're done. The "relevant" fields would typically be the ones that are responsible for the existence of the corresponding Band in the first place. Remember, in our example grouping by Category created the Group Header/Footer: Category Bands, and Category was precisely the Field we placed in the Header. This is most likely what you would want to do most of the time.

 

You can change the grouping order as you would do with any ordinary grid: just drag the columns around in the Group by Box. The corresponding Group Header/Footer Bands will be rearranged accordingly, preserving their contents.

 

Alright, so we have put something interesting in the Header Band, but what about the Footer? Is there anything useful we can place there? Turns out there is.

 

 

Summaries. As all grids in Alventis, the Record List grid supports dynamic creation of Summaries. It does so slightly differently from other grids, but the overall principle is the same. Here's how it works for the Record List grid.

 

Report1H

 

Double-clicking on the Summary row toggles the Summary for the corresponding column On/Off.

Once a Summary is created, passing the mouse over it makes a little dropdown button appear close to the right edge of the Summary.

Clicking on that dropdown button displays a menu that allows you to directly select the mathematical operation you would like this Summary value to use.

As is generally the case, not all operations are supported for all field types (e.g., averaging string values doesn't make much sense), so see what is available on a case-by-case basis.

If a particular column only supports a single operation (e.g., strings only support counting of them), the dropdown button will be grayed-out.

 

You can create both Grid Footer Summaries and Grid Group Summaries.

 

Report1I

 

Whatever Summaries you end up creating, they become listed in the Field grid alongside with ordinary Fields themselves. You can drag-and-drop them exactly like any regular Field wherever it makes sense in the Template. Normally, it would make sense in the Band that corresponds to the Record List grouping level that the Summary "belongs" to. In our earlier example, if after grouping contacts by Category we also created a Count (or any other) Summary counting contacts within each Category group, such a Summary would fit nicely in the Group Footer: Category Band. Or in the Header if you prefer to precede a group of records with some cumulative information about them. Header and Footer Bands are basically "symmetrical" and in all respects interchangeable. You can spread whatever group-level information you want between these two Bands whichever way suits your taste, even repeat some or all of it in both if you like.

 

You may have noticed by now that there are a few elements in the Field grid that are neither Fields, nor Summaries. These are useful InfoFields:

 

TimeStamp is the time you hit Produce Report

Page is the current page number

Number of pages we're not telling

User is the UserID of whoever is producing the Report

Report ID/Name/Caption/Parameters/Filter will output the corresponding information pertaining to this Report. The first 3 are easy. The last two will list the Report Parameters that were in effect and the Record List Filter, if any. Including them in a Report may help the reader understand why the Report includes the records that it includes.

 

Since the InfoFields only appear in the Field grid, you can only drag them into the Template from there. Not so for Fields and Summaries. You can drag Summaries directly from the Record List grid. Fields are a bit trickier. Dragging a column caption sounds like a great idea, but this is something you do to group by columns. To distinguish an act of dragging a Field into the Template, you must Alt-drag-and-drop the column header. Hold down the Alt key and start to drag. You can now release the Alt key at any time. Drop the Field where you want it. You can obviously drag everything from the Field grid, so use whatever you find more direct and convenient.

 

 

Report/Page Header/Footer Bands. We have seen that grouping creates pairs of Bands: Group Header and Group Footer a pair for each level of grouping. You may want to "surround" your output with just two more kinds of Bands.

Page Header/Footer Bands as the name suggests will appear at the top and bottom of every page (when printing).

Report Header/Footer Bands appear as "prologue" and "epilogue" of the Report.

 

You can enable each pair independently by checking the corresponding checkbox under the Field grid.

A Page Header/Footer could be just the right place for the Page and Number of pages InfoFields, as well as whatever else you may find useful there, like the Report Name.

The Report Header could be used as a title page.

The Report Footer may be suitable for the Report info, such as Parameters and Filter. But this is entirely up to you of course.

 

Certain items don't make sense in certain Bands though. For example, a real Field value has no place in any of the Bands we have discussed above. Such a value would not be known at the point in time when the Report Header/Footer or the Page Header/Footer Bands are produced, so Alventis won't let you place some items in Bands that are deemed inappropriate for them. Other than that, you are free to fully unleash your creativity.

 

 

Template Field Formatting. Since the Template is basically just a Memo, the full array of Alventis' formatting tools is available to you: Font, QuickStyle, Colors, and so on. You can lay things out using Memo Tables and/or Tab stops. Whatever works for you.

 

The only thing that is handled differently, are the Fields. You cannot edit a Field. You can delete a Field by selecting it completely and hitting Delete. You can move them around like you'd do with any text. And finally, you can format Fields. This works very much like formatting Hyperlinks: place the cursor anywhere within the Field (or select any portion thereof) and use any of the available formatting tools. The Field gets formatted in its entirety. Whatever text ends up replacing the little Field rectangle, it will be formatted with the Field's format in the Template. Aside from the little border surrounding the Field, that is.

 

You can select what format you want your Fields to have by default. The Report toolbar has a Font button dedicated to just this purpose. It is just like any other Font button in Alventis, except that whatever font it happens to have determines the font of all newly-created Fields. So, if you intend to format all or most of your Template's Fields the same way, set this Field Font button's font the way you want before you start dragging all those Fields into the Template and they will come out the way you wanted and won't require any "post-processing".

Field format is of course meaningless for Fields that represent (and thus will end up being replaced by) Memos and Pictures.

 

 

Memo Fields in Reports. There's nothing particularly special about them. They do have some features you should take into consideration though.

If all your records are known to have short Memos, you can do pretty much whatever you want. For example, arrange the record's Fields in such a way that several fields are in a table cell on the left, and the Memo is in another cell on the right all within the Detail Band. Or maybe you have two short Memos that you would place side-by-side.

If at least some of your Memos are lengthy, you may want to avoid placing the Memo Field into a table's cell. As we have warned you elsewhere, Alventis can't correctly print a very long table cell that is longer than the page length. Such a cell will get cut-off at the bottom of the page together with its contents. Your best bet in such a situation is to forego the use of tables to lay things out, and simply place a Memo Field directly in the Detail Band, most likely on a line by itself. This way, the Memo will not be constrained by a cell in the Report Output, so it will get properly paginated and will span as many pages as necessary.

 

 

Picture Fields in Reports. When you place a Picture Field into the Template, what is placed there is a little Picture that simply states the name of its source Field. By default, when such a Field is replaced by the actual Picture from the data record, the Picture will be output with its "real" original size. This may or may not be what you want, and there are several things you can change. You can simply resize the little Field picture in the Template. The real Picture will be resized to fit whatever width you set for the Field. Only the width matters: the height is always ignored, preserving the original picture's aspect ratio. If your resized Field picture in the Template is wider than the real data Picture, the latter is not stretched though. If you do want it to stretch under such circumstances, you must explicitly set a special attribute of the Field picture. This attribute is accessible from the regular Picture Format dropdown dialog but only for Template's pictures. It's called "Auto-Expand in Report" and you'll find it at the very bottom of the dialog. The Field picture's size must be anything other than default/100% for this attribute to be accessible. If this attribute is set, all data Pictures replacing this Field picture will be shrunk or stretched to end up with the same width.

Reset the Picture dimensions to default/100% to return to the default behavior, i.e., outputting Pictures with their original sizes.

 

You can also place the Picture Field in a table cell. The cell will constrain the output to its size. You probably wouldn't want to use a single-cell Memo Table for the sole purpose of constraining the Picture size, since you can achieve the same effect by simply resizing the Field picture. If the Field picture is already in a cell though, perhaps because you are using a table to better format the Report's layout, the cell-constraint feature comes quite handy.

 

 

Print Preview. Report Output is essentially just another Memo. You can even edit whatever the Report produced in there. All normal editing/formatting operations are available to you. Normally, you should not need to change anything there, but you can if you must. The Report Output Memo has just one little trick up its sleeve: this is the only Memo in Alventis that knows how to print its contents.

 

Printing per se works essentially the same way it works in just about every Windows application: you click the Print button, respond to your printer's dialog box if appropriate, and you're all set. But before you print anything, it's usually a good idea to preview the output, and that's what Print Preview is for.

 

Report1J

 

Clicking the Print Preview toggle button on the toolbar places the Report Output Memo in Preview mode. You can't edit the Memo's contents in this mode. You can merely see the preview of what the printout with your current settings would look like one page at a time.

 

In the Preview mode, you can navigate between the pages of the Output in several ways:

You can use the PageUp/PageDown keys on the keyboard when the Preview is focused
You can use the First/Prior/Next/Last toolbar buttons
You can pick the page you want directly from a combo box
You can type the page you want into the combo box

 

You can zoom in and out of the Preview using several methods:

With the mouse, clicking anywhere in the Preview will zoom in on the clicked spot. Clicking again will zoom back out. Basically, the mouse clicks toggle the zoom level between the current one and 100%.
You can click the Zoom to Full Page and Zoom to Page Width toolbar buttons that will adjust the magnification level accordingly.
You can pick or type-in the zoom factor you want in the Zoom Percentage combo box.
You can zoom in and out by clicking the Numeric +/- keys on the keyboard (the ones on the far right, in the Numeric keypad portion).

 

Note that it is only in the Print Preview Mode that you get to see the Page Header and Footer.

Note also that you can leave the Output Memo in the Preview Mode while you are producing Report Output, adjusting the Template, re-running the Report, and so on.

 

 

Page Setup. You may at some point want to change your page setup, for instance, change your selected paper size and/or Landscape vs. Portrait orientation. You can accomplish all this by clicking the Page Setup button and thus invoking the standard Page Setup dialog. Change whatever you see fit and press OK to see your new settings reflected in the Report Output.

 

 

Margins. The Report Output is also the only Memo in Alventis that has real meaningful margins. Since you are likely to find yourself adjusting them rather frequently, the controls that let you set them are located right above the Output Memo. You can also adjust the left and right margins using the Ruler. The Rulers above the Output Memo and the Template are synchronized, and you can use either one. All adjustments are "live", so you see the effect they have on your page layout immediately, in near-real-time.

While we're on the subject of margins, we'd like to point out something that is a little different about the Print Preview with regards to margins. In many word processors you may be familiar with, the Print Preview displays the whole white page on some shaded background, and the white rectangle you see corresponds to the entire sheet of paper sitting in your printer's input tray. In Alventis, the similar-looking white rectangle represents only the printable area of the page. Most printers cannot print on the entire page edge-to-edge. They usually have to leave small bands on some or all sides. Alventis simply does not include these "off-limits" bands, if any, in the white rectangle it shows you. The good thing about it is that you can know right away how much more usable space you have on each side: the entire white "margin" you see is usable, whereas with most word processors, only some part of it may be usable, and you don't have any indication, which part. The only drawback is that it is, well, different. Which is why we told you about it. That's all.

 

 

Page Breaks. Normally, your Report Output will get auto-paginated according to its contents and your page setup. If you are including any Memo Fields in the Report, and some of these Memos contain Hard Page Breaks, the Report will honor such page breaks unless you place the Memo Field into a table cell (in the Template). The Hard Page Breaks, if any, will end up in a cell, and will therefore be ignored, since Alventis does not support page breaks inside table cells.

You can also insert Hard Page Breaks wherever you want in the Template. For example, you may want to separate the Report Header from the rest of it with a page break, so you'd simply put one at the end of the Report Header Band. Placing a page break at the end of a Group Footer would separate Groups.

 

 

You can save or cancel your changes to the Report Template and the Record List grid setup (grouping/sorting/summaries/filtering) by clicking the Post or Cancel toolbar buttons at the far left of the toolbar.

 

You can also create a clone of the current Report. Clicking the Save As button offers you two choices:

Duplicate Report under Original Query will create the copy of the Report attached to the same query as the current Report.

Duplicate Report under Duplicate Query will create a duplicate of both the query and the report.

 

 

Save Output. Clicking this button displays a list of all tables of the same Database where you could "export" the currently-displayed Report Output. A table "qualifies" as a possible valid destination if it has at least one Memo field (and you have sufficient privileges to create records there). Whichever table you select from the list, a new record will be created in it, and the current contents of the Report Output Memo will be saved in that record's Memo field. This makes it very easy for you to save not only the Report's Setup (Template and Record List grid setup), but the Report Output itself. Maybe this will make printing the Report less necessary under some circumstances and will save a tree somewhere. If you find yourself using this feature regularly, you may want to dedicate a separate Alventis Table to Report Output just to keep things better organized. Note that Page Header and Footer are not saved in this manner since you can only see them in the Print Preview mode.

 

In closing, you must have noticed that the Report form is divided into 3 panes with RotoSplitters between them. Each of the panes is a zoomable Panel, so you can double-click any of them to temporarily maximize them within the Report form.