Difference between revisions of "BIRT/FAQ/Report Layout"
m (→Q: What is the ROM?)
(→Report Object Model (ROM))
|Line 73:||Line 73:|
row + 1;
row + 1;
Revision as of 09:57, 18 April 2008
< To: BIRT/FAQ
Report Object Model (ROM)
Q: What is the ROM?
ROM stands for "Report Object Model." It is the model (or specification) behind BIRT report elements. Just as HTML, CSS and SOAP are standards separate from an implementation, so ROM is a model separate from the BIRT implementation.
ROM is the model behind the palette items, property dialogs, methods and so on. ROM consists of a set of core elements, and rules for adding extended elements.
Elements can have properties. Properties have a type. Property types include simple ones such a string, number, dimension and so on. Property types also include complex ones such as structures, lists, and lists of structures. For example, static text is defined as a structure with text and a resource key for internationalization.
Elements can fit together using "slots". Each element has named slots. For example, the report element has slots for the layout (body), for styles, and so on.
Elements can have methods & expressions (code). These are specialized forms of properties.
In a later release, elements will be able to inherit from another element. This will allow reuse. For example, you can define a data source in a library, and use it in multiple report designs.
ROM provides styles and style properties. ROM's style system is based on CSS, extended for use within a report. Users can create their own styles, or can use many predefined styles. Predefined styles in ROM select specific report items. For example, the "report" style sets defaults for the entire report. As in CSS, styles cascade. Style information set on a container element cascades to its contents.
To learn more about ROM, read the ROM Specifications located in the reference area of this web site.
Q: What is the XML design file?
BIRT stores your report design in a "design file." This file is in XML format and has a ".rptdesign" suffix. The XML design file is created by the BIRT designer and directly executed by the BIRT engine; there is no compilation step.
Q: What is the ROM schema?
The BIRT XML design file is defined by an XML schema. At present, the schema is located in the BIRT source code in the org.eclipse.birt.report.model project in the src\org\eclipse\birt\report\model\parser\design.xsd file. Eventually, it will move to a well-defined location on the Eclipse web site.
The schema is designed to allow extensions. The schema defines syntax that allows extensions to be added to BIRT without making changes to the actual schema. For example, an extended item uses the following tag:
Properties are in a generic form:
In this sense, the schema describes a syntax for representing report elements in general. The schema does not list the properties, for example; that is defined in a separate rom.def file that is derived from the ROM specification.
Q: What is rom.def?
The ROM schema defines the syntax for the XML design file. The specific set of ROM-defined elements, their slots, and their properties are defined by a separate internal metadata file called rom.def. This file is in the BIRT source code in the org.eclipse.birt.report.model in the src\org\eclipse\birt\report\model\elements\rom.def file.
The metadata subsystem of the BIRT model provides a Java API to access this information. Data Display
Q: How do I display page numbers in HTML or PDF?
The element will allow you to say something like:
Page $page of $count
At runtime, this will be replaced by:
Page 1 of 5
Release 1.0M2 Note: The page number element has not yet been released. Syntax is still subject to change.
Q: How do I display today's Date?
Add a data item. For the expression, enter:
new Date( );
Then, in the Format page of the Property Editor, choose the date format you prefer, such as Medium Date for a display of Apr 15, 2005.
Q: How do I display the row number?
Suppose you want to display a list of items, along with the row number of each. BIRT provides the row variable that gives data for the current data row. row provides the 0-based row index. You can display a 1-based count as follows:
row + 1;
Q: How to remove Date appearing in the Templates provided by BIRT ?
Select the preferred template and once the report designer editor opens ... Select the Master Page tab. In this delete the date component from the footer.