Working in the Design View |
Designing and Printing Reports > Working in the Design View
The Design View is the first view you see when you create a new report. It's the place where you can set up the report template with the fields and other text you'd like to use. You can also perform standard text formatting in the Design View, as well as move fields to different cells or change column widths. When working in the Design View, you can easily toggle to the Layout View (by clicking the Toggle View icon on the top right of the Navigation Bar or by selecting Layout from the View menu) to see how your template will look when printed or when saved as a PDF file.
Below we will discuss the following areas of the Design View:
Working with Report Sections
A report is simply a template that repeats over and over again based upon certain triggers. For instance, if we create a template that is a group with related detail, that template will repeat over and over in the report until we run out of groups. In the most basic report, where we just have a single detail section, the detail section (each row/record) repeats over and over until all records are displayed.
So, in the example above, we have a group based upon City and State, with the Customer name and Total amount as the detail listed for that group. Click here to see the Layout View/Print Preview of this template. When a report comes to a new group, the related detail is shown. Then, when the detail for that group is exhausted, the report goes on to the next group and displays that detail. It then continues in the same fashion until the end of the report.
The Design View enables you to create this repeating template. The Layout View then lets you see what the actual report looks like when that template is filled out with actual data. The following sections are available in the report template (note that many of these may be toggled on/off from the Report Settings dialog):
Since almost all the sections above repeat, any formatting or spaces placed in those sections will also repeat. Therefore, if you have a detail row with data in it and include two blank rows below, this group of three rows will repeat for each detail record in the report (i.e., you will have two rows worth of space between each detail record in the layout view).
Working with Columns, Rows and Cells
The design view's controls work very similar to a spreadsheet:
Adding Fields and Other Text
Once you have defined your report settings and groups, you can now start to add the text that will be displayed in the report.
Adding Fields
The most important type of text are the data fields. Fields can be added into any cell by using an equal sign (=) in front of the field name:
=fieldname
When you switch to the Layout View, the report will show the actual data from this field, and repeat it as defined in your sections.
In addition to typing the names of the fields in the cells, you can use the Fields Panel. The Fields Panel shows a list of all the fields in your Source Table. You can simply double-click or drag fields from the Field Panel to the cells in your report. Or, to add multiple fields at once, highlight multiple fields in the Field Panel and then drag them into the report.
To open the Fields Panel, either select Fields Panel from the View menu or click on the Fields Panel icon on the bottom left side of your screen, in the status bar.
Adding Text
In addition to fields, you can add other text by just typing into the cells. This is useful for creating a name for your report or adding names for your fields. If you add text to sections that repeat, the text will also repeat based on the section. So, for example, if you placed the following into your Detail section:
Your layout view would appear as follows:
Adding Page Numbers, Subtotals and Other Formulas
In addition to adding fields and text, you can also add other information using formulas.
Informational Functions
Often when creating a report, there is a need to provide additional information such as the date the report was created or the page numbers. The information options as follows:
The respective function syntax for each of these are as follows:
=pagenumber() =pagecount() =curdate() =datasource()
Aggregate Functions
In addition, you can create subtotals within group headers and footers or totals in a report footer. To do this you simply need to add an aggregate formula in a cell. Aggregate functions perform calculations on each group. The following functions are available in the report writer:
The respective function syntax for each of these aggregate functions are as follows:
=min(fieldname) =max(fieldname) =sum(fieldname) =avg(fieldname)
A "group" in this case can also mean the entire dataset. Therefore, you can create a total in a report footer section on the entire report in the same way you can create a subtotal based on a specifically defined group in a group footer section.
Using Formulas in Report Cells
As we've seen above, you can create simple formulas in a cell using the equal sign ("=") to preface the function. So, if you wanted to just show text in the layout view, such as for a header, you just type in the text you wish to show. However, if you wish to use a variable (such as a record in a field) or a function (such as a page number), you simply need to preface it by using the equal sign, such as:
=pagecount() =myfield =sum(myfield)
However, you may also create more advanced formulas using any of the functions normally offered for other data processing tasks. Click here for an overview of using formulas to create calculations. So, in a report you could create formulas such as:
A simple calculation, that would result in a "4" appearing in the layout view:
=1 + 3
A calculation that subtracts one field from another, such that the net amount would appear in the layout view:
=gross_amt - discount
A calculation that parsed a single item out of a text field:
=strpart(packsize,3)
Variables within a string of text, such that a result like "Page 2 of 23"
="Page " + str(pagenumber()) + " of " + str(pagecount())
NOTE: In the above example, the pagenumber() and pagecount() functions are numeric by nature, so in order to use them in a text string, you need to convert them to text. Hence we used the STR() function. Also, please note that we added spacing within the text itself ("Page ") to produce the proper spacing in the layout view.
Quick Formulas
In addition to creating formulas within cells, you can also add quick, pre-built formulas via the right-click menu. Right-click on any cell and select Insert Formulas. The menu will expand and you can select formulas such as "Page Number of Page Count" or "Date" which will populate your cell with the appropriate formula syntax.
Learn More
For further information, see the following sections:
|