9 Creating Reports With Report Wizard And Report


Download 9 Creating Reports With Report Wizard And Report


Preview text

9
CREATING REPORTS WITH REPORT WIZARD AND REPORT DESIGNER
9.1 INTRODUCTION Till now you have learned about creating Table, Query and Form using the respective Wizard and Designer mode. Every application has various types of reports. Report wizard and Report Designer are the main tools available in Visual FoxPro for taking outputs. These report tools are designed to meet a range of needs and requirements from very simple and limited to more complex and versatile. Visual FoxPro provides two types of report wizard: Report Wizard and Oneto-Many Report Wizard. The Report Wizard formats a single table report. The One-to-Many Report Wizard is like the One-to-Many Form Wizard, which uses a parent-child relation between two tables to create a report. 9.2 OBJECTIVES After going through this lesson, you would be able to
create a Report with Report Wizard create a Report with One-to-Many Report Wizard

142 :: Computer Applications
create a Report with Report Designer group data in Report Designer add Title and Summary Bands in Report print Report 9.3 CREATING REPORT WITH REPORT WIZARD Reports can be created using: (i) Report Wizard (ii) Report Designer To create a report by using Report Wizard, choose New option from File menu or directly choose New from the toolbar. The New dialog box appears with which you are quite familiar, as you have seen during creating Table, Query and Form using the respective Wizard. Choose Report radio button and then click Wizard push button. Visual FoxPro displays the Wizard Selection dialog box as shown in figure 9.1. There are two types of report wizard available in this dialog box One-to-Many Report Wizard and Report Wizard. You have to choose one of them. Let us select the Report Wizard to display the “Step 1 - Select Field ” page of the Report Wizard dialog box.
Fig. 9.1: Selecting a Report Wizard

Creating Reports with Report Wizard and Report Designer :: 143
9.3.1 Selecting the Table The first step in the Report Wizard, like the first step in the Form Wizard, is to select the table and the fields you want in your report. This dialog box is similar to the one you have seen in Query and Form wizards. You first need to select the database, followed by the table and then the individual fields you want to include in the report. The Database/Tables option available with the first step of Report Wizard dialog box, displays the current database, if one is open. Otherwise it displays the words Free Tables. If a database is open, the names of the tables it contains appears in the scrollable list and you can choose the required table. If the database is not open, or if you want to use a free table, click the ellipsis button (…), which opens a dialog box that allows you to select the required table as shown in figure 9.2. Let us select the STUDENT.DBF table from the open dialog box for creating a report. 9.3.2 Selecting Fields The “Step 1-Select Fields” dialog box also includes Field picker buttons or movement buttons, which are found between the Available fields list and Selected fields list. The arrow directions indicate the way they move fields. A single arrow moves a single field. Double arrow buttons move all the fields. To move a field from the Available fields list, first select the field you want to move by clicking or by using the up and down arrow keys and then click the top buttons with the right arrow. This moves the highlighted field to the Selected fields list. Repeat this process to move more fields from the Available fields list to Selected fields list as shown in the figure 9.2.
Fig. 9.2: Step 1 - Selecting Fields for the Report Wizard

144 :: Computer Applications
If you want to move all the fields from Available fields list to Selected fields list, just click the double-right arrow. If you have selected the wrong fields or change your mind, then you can deselect a field from the Selected fields list. Select that field and click the left arrow. Similarly, you can choose the double-left arrow to move all the fields from the Selected fields list to Available fields list. Choose Next push button to proceed further. Let us select Enrol, Name and Course fields from the Available fields and move them to Selected fields list as shown in the figure 6.2. Choose Next to move to next step of the Report Wizard. 9.3.3 Group Records The Step 2 - Group Records of Report Wizard allows you to define grouping of records. You can select up to three levels of grouping as shown in the figure 9.3. In the three different levels of grouping of records, you have to select the field on which the grouping is done or select if no grouping of records is required. Choose Next to proceed further.
Fig. 9.3: Group Records of Report Wizard

Creating Reports with Report Wizard and Report Designer :: 145
9.3.4 Selecting Style The Step 3 - Choose Report Style of Report Wizard allows you to define the over all report style. Visual FoxPro provides five standard report styles
Executive Ledger Presentation Banded Dff In the upper left corner of the dialog box, you can preview an illustration of each style as you select it, see figure 9.4.
Fig. 9.4 : selection of Style of the Report Wizard
9.3.5 Specifying Layout The step 4 - Define Report Layout of Report Wizard allows you to define the over all layout of the report as shown in the figure 9.5. The first option defines the field layout. The two options are either

146 :: Computer Applications
Columns or Rows. If you have few fields which can fit across the page horizontally, consider the Column style report because it fits more records on a page. However, if you have many fields in each record to display, you may have to consider a Row style layout. Use the Orientation buttons to identify the paper orientation, either portrait or landscape. The number of columns determines the number of columns or repeated data that can appear across a page. For example, if you use a row style field layout, the data may not extend beyond the middle of the page. In this case, you can consider having two columns on the page to double the amount of information printed on each page. Choose Next to proceed further.
Fig. 9.5: Define Report Layout
9.3.6 Specifying Sort Order Choosing Next option brings you to the “Step 5 - Sort Records” of the Report Wizard. It allows you to specify the sort order for the records, as you do in other wizards. You can select any field from the Available Fields list and move it to the Selected Fields list by

Creating Reports with Report Wizard and Report Designer :: 147
clicking the Add > key. You can select even more that one field for the sorting order. However, the order in which you select these fields determines their sort priority. You can change the sort priority by moving the selected field using the double-headed buttons to the left of the field names. Just click a double-headed button and drag it up or down to a new position. If you have selected a wrong field for the sorting order or if you want to remove any field from the Selected Fields list to the Available Fields list, then select the field you want to remove and then click the push button. Let us select Enrol field from the Available Fields list and move it to the Selected Fields list for specifying the sorting order as shown in the figure 9.6.
Fig. 9.6: Sort Records of Report Wizard
You can also sort the data in ascending or descending order. Choose Next push button to proceed further. 9.3.7 Generating the Report The final step of the Report Wizard, as shown in the figure 9.7, appears when you click Next push button from the Sort Record

148 :: Computer Applications
Step. Here you only need to supply the report title. The text appears at the top of the report. You can have three options:
Save report for later use Save report and modify it in the Report Designer Save and Print report The first option lets you save the report for later use and then returns you to whatever you were before you started the Wizard. The second option saves the report and immediately opens the Report Designer with the new report allowing further customization. The third option saves the report and immediately prints it.
Fig. 9.7: Finish of the Report Wizard
You also have an option to wrap fields onto continuation lines, if they do not fit the column widths defined. You can use the Preview push button to preview the reports before actually saving it. Figure 9.8 shows the Preview window of the report.

Creating Reports with Report Wizard and Report Designer :: 149
Fig. 9.8: The print Preview Window
You can still return to the previous steps in the wizard by clicking the Back button. However, if you save the report any subsequent modifications in the report must be made through the Report Designer. Note that you can not re-enter the Wizard for an existing report. Once you are satisfied with your report, click the Finish push button to save your report. The Save As dialog box appears on the screen, where you need to mention the name of your report in the text box. Visual FoxPro save the report file with an extension name .frx You can save the report as STUDENT.FRX. 9.4 CREATING A REPORT WITH ONE-TO-MANY REPORT
WIZARD The One-to-Many Report Wizard is similar to the One-to-Many Form Wizard. The various steps involved in creating a One-to-Many Report Wizard are similar to the Report Wizard that was covered in the previous section of this lesson. The primary difference is that it creates reports using two or more tables. More specifically it creates a report to display individual parent records and all of their children.

150 :: Computer Applications
To create a One-to-Many Report, choose New option from File menu or click the New tool box. The New dialog box appears. Select the Form radio button and then click the Wizard push button. Visual FoxPro displays the Wizard Selection dialog box as shown in figure 9.9.
Fig. 9.9: Wizard Selection Box
Choose the One-to-Many Report Wizard form Wizard Selection dialog box. The “Step 1- Select Parent Table Fields“ dialog box appears to select the fields from the main or parent table. It is similar to the first step of the regular Report Wizard shown in figure 9.10.
Fig. 9.10: Fields from Parent Table of One-to-Many Report Wizard

Preparing to load PDF file. please wait...

0 of 0
100%
9 Creating Reports With Report Wizard And Report