Report schema transformations
A report schema transformation (.rst) is a type of schema file that provides access to data from pre-defined sources.
You can use report schema transformations for:
- Random access to data. For example, you print a table of delivery addresses followed by a list of packaging instructions, even though the data stream delivers the packaging instructions before the delivery addresses.
- Changing how data is streamed without having to modify the program. For example, the sales data in the data source is grouped by customer and season, but you regroup this data by country and product line.
- Restructuring of data from pre-defined data sources such as SAP-BAPI or Pentaho Kettle.
The report schema transformation contains:
- A reference (
r
) to an input schema file or a transformed schema file. - A description of the transformation to apply to the input schema.
Report schema transformations are used in the Report Designer in the same way as other data schemas. When the transformation is applied, the result displays in the Data View.
Transformation features
The features of report schema transformations include:
- Grouping data using variables.
- Sorting data, either before or after grouping.
- Duplication of any part of the data. For example, you can use the same data to draw a chart and a table.
- Rearranging record lists and variables. For example, you can move the order total from the bottom to the top of the list.
- Computing aggregates, such as average, minimum, and maximum.
- Computing running aggregates. These are useful for printing values that depend on page breaks, such as "Carried forward" and "Total until this point".
- Cascading transformations, where one transformation can be used to create another.
Transformations at runtime
Report schema transformations are also used by the report engine at runtime. When a report design
file (.4rp) is based on a report schema transformation
(.rst), then the engine applies the transformation to the
data. If r
references a report schema transformation, then the
process is repeated recursively. The data is always transformed in serial manner,
but some transformations (such as sorting) may cause latency.
Transformations in the demo application
The OrderReport demo application (Reports.4pw) includes sample report designs that use report schema transformations:
- The RevenueAnalysis.4rp report demonstrates duplication of data.
- The PivotOrderList.4rp report demonstrates regrouping and aggregations.
- The FancyPivotOrderList.4rp report also demonstrates regrouping and aggregations, as well as a running total used to print "Carried forward" and "Total until this point" values.