Difference between revisions of "SUN Report Builder/Example"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (550)
(data)
Line 1: Line 1:
 
Data Model
 
Data Model
 +
 +
The example will use a very simple, and common, data model. Two tables, one a list of products and the other a list of the cost for multiple purchases of each product. Referred to as One to Many ( 1..n) relation.
 +
 +
Products Table ( Table2 )
 +
{| class="prettytable" cellpadding="10" border="1"
 +
| <center>ProductID</center>
 +
| <center>ProductName</center>
 +
 +
|-
 +
| <center>0</center>
 +
| <center>Apples</center>
 +
 +
|-
 +
| <center>1</center>
 +
| <center>Oranges</center>
 +
 +
|-
 +
| <center>2</center>
 +
| <center>Grapes</center>
 +
 +
|-
 +
| <center>3</center>
 +
| <center>Melons</center>
 +
 +
|}
 +
 +
Product Cost Table ( Table1 )
 +
 +
{| class="prettytable" cellpadding="10" border="1"
 +
| <center>ProdID</center>
 +
| <center>Cost</center>
 +
 +
|-
 +
| <center>0</center>
 +
| <center>2</center>
 +
 +
|-
 +
| <center>0</center>
 +
| <center>1</center>
 +
 +
|-
 +
| <center>0</center>
 +
| <center>3</center>
 +
 +
|-
 +
| <center>0</center>
 +
| <center>4</center>
 +
 +
|-
 +
| <center>1</center>
 +
| <center>1</center>
 +
 +
|-
 +
| <center>1</center>
 +
|
 +
 +
|-
 +
| <center>1</center>
 +
| <center>4</center>
 +
 +
|-
 +
| <center>1</center>
 +
| <center>7</center>
 +
 +
|-
 +
| <center>2</center>
 +
| <center>9</center>
 +
 +
|-
 +
| <center>3</center>
 +
|
 +
 +
|-
 +
| <center>3</center>
 +
|
 +
 +
|}
 +
 +
The report will display all cost records for each product, and group by the product name. Therefore a query is used to put the data from the two tables into one contiguous result set, for use by the report builder.
 +
 +
  
 
Report layout
 
Report layout

Revision as of 15:38, 17 October 2007

Data Model

The example will use a very simple, and common, data model. Two tables, one a list of products and the other a list of the cost for multiple purchases of each product. Referred to as One to Many ( 1..n) relation.

Products Table ( Table2 )

ProductID
ProductName
0
Apples
1
Oranges
2
Grapes
3
Melons

Product Cost Table ( Table1 )

ProdID
Cost
0
2
0
1
0
3
0
4
1
1
1
1
4
1
7
2
9
3
3

The report will display all cost records for each product, and group by the product name. Therefore a query is used to put the data from the two tables into one contiguous result set, for use by the report builder.


Report layout


Functions used

The Sun Report Builder allows creation of user defined functions at two levels. The report level and the group level.


Group Report Totals.gif

Personal tools