Pentaho 5.0 Reporting by Example
上QQ阅读APP看书,第一时间看更新

PRD layout

Now we will analyze the PRD layout bit by bit.

We can identify the following sections in the layout:

  1. Work area
  2. Insertable objects
  3. Report tree structure
  4. Style and Attributes
  5. Data panel
  6. Menu bar
  7. Shortcuts
  8. Tab section
  9. Format tools
  10. Message section and memory indicator

We will see the most important options in each section, and we will specify the area of the PRD layout where each of these sections are located.

The Work area

This is found at the center of the screen. This area is more commonly called Canvas, and this is where we will place the fields, charts, lines, and so on that we want to see in the report.

To the left of the Work area, we will find the following sections:

  • Page Header
  • Report Header
  • Details
  • Report Footer
  • Page Footer

By default, only these sections are visible in the Work area of the new reports. There are other predetermined sections that are initially invisible, such as Group Footer and Group Header. New sections can also be added as subgroups.

Insertable objects

These are found on the left-hand side of the screen. Here we will find all of the elements that we can add to our reports. Among these elements are fields, graphics, text, lines, subreports, sparklines, and so on.

Now we will describe each of the insertable objects' labels:

  • Label: This lets us insert a static text. This is often used for titles, subtitles, legends, labels, headers, and so on. This field appears as an icon on the left-hand side pane as follows:
  • Text field: This field appears as an icon on the left-hand side pane as follows:

    This lets us insert text fields from our data source in the report and represent values of type text. When we insert a text field in the report, we are using a Text field component.

  • Number field: This field appears as an icon on the left-hand side pane as follows:

    This lets us insert number fields from our data source in the report and represent values of type number. When we insert a number field in the report, we are using a Number field.

  • Date field: This field appears as an icon on the left-hand side pane as follows:

    This lets us insert date/time fields from our data source in the report and represent values of type date/time. When we insert a date/time field in the report, we are using a Date field.

  • Message: This field appears as an icon on the left-hand side pane as follows:

    This lets us insert fields with large texts and lets us combine various fields and texts in expressions. They are used, for example, to create strings such as "Today is the $(day) of $(month), $(year)". To obtain the same result, we would have to use multiple instances of the following objects: Label, Text field, Number field, and Date field.

  • Resource label: This field appears as an icon on the left-hand side pane as follows:
    This object behaves similarly to Label (Insertable objects) with the difference that Resource label takes its value from an internationalized file. These are used when text in the report has to change based on the user's location.
  • Resource field: This field appears as an icon on the left-hand side pane as follows:
    This is similar to the Resource label (Insertable objects). The only difference is how the key for obtaining the resource is established. In this case, the value is not constant but is obtained from the data source.
  • Resource message: This field appears as an icon on the left-hand side pane as follows:
    This is similar to Message (Insertable objects) in its possibilities but in this case, the expression can be obtained from a resource file and, as such, internationalized.
  • Image field: This field appears as an icon on the left-hand side pane as follows:

    This lets us insert images obtained from our data source. When we insert an image field in the report, we are using an Image field. They are used to display product images, photos of people, logos, and so on.

  • Image: This field appears as an icon on the left-hand side pane as follows:

    This lets us insert images obtained from a physical location. The images can be linked or embedded in the report. This is mainly used for images that are placed at the head or foot of the report, for example, the logo that represents the organization or a report's background image.

  • Ellipse: This field appears as an icon on the left-hand side pane as follows:

    This lets us insert an ellipse in our report.

  • Rectangle: This field appears as an icon on the left-hand side pane as follows:

    This lets us insert a rectangle in our report.

  • Horizontal line: This field appears as an icon on the left-hand side pane as follows:

    This lets us insert a horizontal line in our report.

  • Vertical line: This field appears as an icon on the left-hand side pane as follows:

    This lets us insert a vertical line in our report.

  • Survey scale: This field appears as an icon on the left-hand side pane as follows:

    This lets us insert a widget that displays quantitative values graphically. The possible values are defined as a continuous line, the displayed value as a point on this line, and the limits of different ranges as figures. They are used to graphically and simply display the values of surveys, evaluations, indicators, and so on.

  • Chart: This field appears as an icon on the left-hand side pane as follows:

    This lets us insert charts in our reports. There is a great variety of charts that we can use. Charts are commonly used to represent information in a simplified manner.

  • Simple bar codes: This field appears as an icon on the left-hand side pane as follows:

    This lets us insert bar codes in our reports. Bar codes are commonly used in order to be read and decoded by a specialized machine later. Bar codes are habitually used in billing, library management, inventory control, movement control, shipping control, receipts, documents, and so on.

  • Bar sparkline: This field appears as an icon on the left-hand side pane as follows:

    This lets us insert bar sparklines. They are generally used to graph comparative information in detail.

  • Line sparkline: This field appears as an icon on the left-hand side pane as follows:

    This lets us insert line sparklines. They are generally used to graph information on tendencies or evolution in time in detail.

  • Pie sparkline: This field appears as an icon on the left-hand side pane as follows:

    This lets us insert pie sparklines. They are generally used to graph comparative percent information in detail.

  • Band: This field appears as an icon on the left-hand side pane as follows:

    This lets us insert a band in our report. This band lets us group other Insertable objects and treat them as a whole. This facilitates managing and editing complex reports.

  • Subreport: This field appears as an icon on the left-hand side pane as follows:

    This lets us insert a subreport in our report. These are usually used when we need to show different levels of granularity or information that comes from diverse queries in the same report.

  • Table of content: This field appears as an icon on the left-hand side pane as follows:

    This lets us insert a table of contents based on report data. These are used when there is a large quantity of data in the report, and we want to exactly know on which page each group begins.

  • Index: This field appears as an icon on the left-hand side pane as follows:

    This lets us insert an index based on report data. These are commonly used when we want to know on which page of the report the data from a particular column is found.

Report tree structure

This is found in the upper-right area and the Structure tab should be chosen. This is where the report layout is displayed. This facilitates navigating in the report and editing its components.

As you can see, the organization of the report's sections is presented in a tree hierarchy. For example, the sections Group Header, Details Body, and Group Footer are child nodes of Group. Similarly, the Insertable objects added to each of the sections will be their child nodes.

The Insertable object Band (Report tree structure) creates a new level in the hierarchy.

Style and Attributes

This is found in the lower-right area and is activated by selecting a branch in the tree structure or an Insertable object. This panel lets us configure all of the details of the selected object.

Once an object is selected, this panel lets us configure its characteristics. To facilitate editing, the characteristics are grouped in two tabs as follows:

  • Style: These let us configure how the object is rendered
  • Attributes: These determine the object's behavior and interaction with the report

Additionally, the characteristics in each of these tabs are grouped according to their function. For example, when adding Label in the Style tab, in the size & position group, we can see the attributes x, y, width, height, and visible.

All of the characteristics should have a value. If a value is not specified, a default value will be used. In many cases, the default value is null; moreover, the configuration of sections will be inherited by the Insertable objects that are placed on it. If we want to specify a value, we can do it in the Value column or use the graphic expression editor (Style and Attributes). This is a very important characteristic that PRD offers, as once a value is established, a constant value can be specified or a value can be generated using a complex expression.

Another important point is that in the Style tab, when a characteristic's default value is modified, the box Inh is unchecked (Style and Attributes). This lets us quickly determine which characteristics have been modified. In the Attributes tab, something similar happens when the Style and Attributes option is used but in this case, the icon is replaced by Style and Attributes.

The Data panel

This is found in the upper-right area and the Data tab should be chosen.

This is where the following fields are configured:

  • Data sets: These are data sources that will be used in the report. We can define one or more data sets in our report but only one will be the Main. Using Data Sets Main, we will be able to drag-and-drop your fields in the Work area. Other Data Sets can be used for other purposes, for example, to fill selectors (lists, combos, checks, and so on).
  • Functions: Functions that are once defined can be inserted in the report or used as variables. Using functions, we can create totals and subtotals, calculate the maximum, minimum, and average, create mobile calculations, and so on.
  • Environment: These are environment variables whose values can be used to design our report. For example, we can make a graph visible or invisible according to the value of the variable, userName.
  • Parameters: These are input parameters and filters. For example, we can use parameters for the user to select a year so that the report displays information related to this year.

The menu bar

The Menu bar lets us access PRD's functions in the traditional form, which is context free. In other words, all of the available options are found in the same menu and grouped into submenus.

Shortcuts

PRD displays the most used functions in the shortcut bar.

Now we will introduce each of the options and their respective functions:

  • To create a new report, click on the following icon:
  • To open an existing report, click on the following icon:
  • To save changes made to the report, click on the following icon:
  • To publish the report to the Pentaho BI Server, click on the following icon:
  • . To add a new data source, click on the following icon:
  • To visualize the report in different formats, click on the following icon:
  • To activate the option that lets us select various objects added to the report, click on the following icon:
  • To undo the changes, click on the following icon:
  • To redo the changes, click on the following icon:
  • To cut objects from the report and place them on the clipboard, click on the following icon:
  • To copy objects in the report and add them to the clipboard, click on the following icon:
  • To paste objects from the clipboard into the report, click on the following icon:
  • To delete objects from the report, click on the following icon:
  • To open a window with a list of all the report's available fields, click on the following icon:

The tab section

PRD organizes open reports and subreports in tabs allowing us to alternate among the different reports in the main window. The title of each report is used as the title of each tab; if the report is untitled, the name of the file is used.

Note

The title of a report is a part of the report's descriptive metainformation. To access this information, we should choose the option File | Report Properties... from the Menu bar. Also, if we select the node Master Report in the tab Structure, we can modify/see the report title in Attributes.name (the common category).

Format tools

It is located above the Work area.

Here we find the following options:

  • The following icon displays the report in preview mode:

    To return to the editing mode, click on the icon again.

  • The following icon lets us change the font type and size:
  • The following icon lets us make the font bold, italic, and underlined and change the font's color:
  • The following icon lets us change the justification of texts:
  • The following icon lets us create hyperlinks:

Message section and memory indicator

This is the section that PRD uses to communicate to us if an exception occurs or there is a warning.

A widget is also constantly displayed with information about the RAM used and the assigned limit as follows:

Note

The RAM information widget can warn us if we need to assign more RAM to PRD. Chapter 2, Installation and Configuration, explains how to configure this.

The icon Message section and memory indicator indicates warnings.

If we click on this icon, a panel will be opened at the bottom of the screen as follows:

The icon Message section and memory indicator indicates exceptions. If we click on this icon, a new window will be opened as follows:

Have a go hero

We propose you to open a sample report (Buyer Report) and analyze their design through the layout areas.

The steps you should be following are roughly the following:

  1. To open this report, you must navigate to Help | Sample Reports | Operational Reports | Buyer Report in the top menu.
  2. Select the objects in the Work area and see what are the kind of objects (Attributes.type).
  3. See how the inserted objects are organized in the hierarchical tree.
  4. See the data sets used and their respective fields.
  5. See how the functions are configured.
  6. See the parameter line and view its settings.

Pop Quiz – layout of PRD

Q1. Which of the following affirmations are true?

  1. Work area is the place where we will design our reports.
  2. The object number field is similar to the object label, with the particularity that the number field allows us to assign a numerical value.
  3. The difference between image and image field is that image field can get the image of our data source.
  4. We can add objects to our reports only from the Insertable objects area.
  5. We can configure all the details of our objects on Style and Attributes.
  6. Every time we open a new report, it is shown in a new window.
  7. The Structure tab shows all sections and objects of our report organized in the hierarchical tree.
  8. From the Data panel area, you can only manage data sets, functions, and parameters.