📜  Pentaho-函数

📅  最后修改于: 2020-11-30 05:38:54             🧑  作者: Mango


报表的每个页面都包含一个页眉区域和一个页脚区域。其余页面可用于实际报告内容。

页面页脚选项卡用于显示一些属性和功能。例如,我们可以在页脚中打印员工年龄字段的最大值。报告引擎通过使用功能允许这些功能。

让我们使用与前几章中相同的雇员表。在将所有字段添加到报表工作区之后,现在让我们在“页脚”选项卡中添加一个函数以找出员工的最大年龄。

请按照以下步骤将预定义函数添加到您的报告中。

步骤1-单击功能按钮( f x )

看一下下面的截图。在此,结构窗格中的“数据”选项卡包含符号f x (标记为“ 1 ”)。这是添加函数按钮。单击此按钮可将不同功能添加到报告中。

页脚

步骤2-选择特定功能

然后,您将找到一个对话框,其中具有不同功能的对话框分为不同的组。要在页面页脚打印雇员的最大年龄,我们应该在“摘要”组中选择“最大”函数,在以下屏幕截图中将其标记为“ 1 ”。选择它,然后单击“确定”

特殊功能

单击“确定”按钮后,该函数将被添加到位于屏幕右侧的“结构”窗格中的“功能”标签。

第3步-定义字段名称

选择添加的函数(即“最大值”)后,您将在结构窗格下面找到另一个窗格,其中包含该函数的属性。

看下面的屏幕。最大化的框包含两个指针(指针1和指针2)。

  • 指针1-在结构窗格的数据选项卡中选择函数。

  • 指针2-通过从下拉列表中选择年龄字段,在属性部分中编辑字段名称。这是因为我们必须打印员工的最大年龄。

自定义属性

步骤4-向报表工作区添加功能

现在,该函数已准备就绪,具有自定义属性。现在,您可以在报表中使用该函数作为页脚属性。

看一下下面的截图。同样,它包含两个指针(指针1和指针2)。

  • 指针1-选择“最大”函数并将其从“结构”窗格拖到工作区中的页脚区域,如以下屏幕快照所示。现在,报告的设计已准备就绪。

  • 指针2-选择屏幕左侧的“预览”按钮。

预览报告

第5步-检查预览

看下面的屏幕。它显示报告的预览。标记了员工的最大年龄,并在最大化框中显示了该年龄。

最大化的盒子

Pentaho-附加功能

下表提供了可以在报告中使用的其他功能列表。

Common Functions
S.No. Function Name Purpose
1 Open Formula Enables you to create your own custom Open Formula function using the built-in Formula Editor.
2 Page Count the number of page used in report before rendering.
3 Total Page Count List the total number of pages in the rendered report.
4 Page of Pages Prints the current page number along with the total number of pages in the render report.
Report Functions
S.No. Function Name Purpose
1 Is Export Type Tests whether the given export type has been selected for this report.
2 Row Banding Alternates the background color of each item band in a group.
3 Hide Repeating Hides equal values in a group. Only the first changed value is printed.
4 Hide Page Header and Footer Hides the page header and footer bands when the output type is not pageable.
5 Show Page Footer Only shows the page footer on the last page rendered in the report.
Summary Functions
S.No. Function Name Purpose
1 Sum Calculates the sum of the selected numeric column.
2 Count Counts the total number of items contained in a group. If no group is specified, all items in the entire report are counted.
3 Count by Page Counts the total number of items contained in a group on one rendered page. If no group is specified, all items on the entire page are counted.
4 Group Count Counts the total number of items in the selected groups. If no group is specified, all items in all groups are counted.
5 Minimum Identifies the lowest or smallest value in a group.
6 Maximum Identifies the highest or largest value in a group.
7 Sum Quotient Performs simple division on the sum totals from two columns and returns a numeric value.
8 Sum Quotient Percent Performs simple division on the sum totals from two columns and returns a percentage value.
9 Calculation Stores the result of a calculation. This function is used in groups.
10 Count of pages Counts items on a page according to the specified criteria. This value is reset to zero when a new page is reached.
11 Sum of Pages Adds all of the specified items on one page and produces a total. This value is reset to zero when a new page is reached.
Running Functions
S.No. Function Name Purpose
1 Sum Calculates a running total sum of the specified column.
2 Count Count the items in a group or in a report.
3 Group Count Counts the number of groups in a report.
4 Count Distinct Counts the distinct occurrences of a certain value in a column.
5 Average Calculates the average value in a given column.
6 Minimum Identifies the lowest or smallest value in a column.
7 Maximum Identifies the highest or largest value in a column.
8 Percent of Total Calculates the percentage value of a numeric column. The total sum is divided by the number of items counted.
Advanced Functions
S.No. Function Name Purpose
1 Message Format Formats text according to the Java Message Format specification.
2 Resource Message Format Formats text from a resource bundle according to the Java Message Format specification.
3 Lookup Maps a string from one column to another string.
4 Indirect Lookup Returns a value from a mapped field.
5 Resource Bundle Lookup Performs a resource-bundle lookup using the value from the defined field as a key in the resource bundle.
6 Open Formula Enables you to create your own custom Open Formula function using the built-in Formula Editor.