<< Click to display table of contents >> ReportWorkshop Overview | Extending Report Workshop |
Report Workshop can be customized by implementing plug-ins.
The following plug-in types can be implemented:
•additional types for data fields
•standard query processors
•additional data provider components
•additional value visualizers
•additional functions for expressions
•additional aggregate functions for cross-tab reports
We are interested in third-party plug-ins for Report Workshop. If you decide to make one, please contact us. We will offer a technical help, and rewards for authors of interesting plug-ins (free licenses or discounts on our products, and others).
Data fields have the following syntax: <full data field name>[ <field type>][ "<format>"]
Report Workshop implements standard field types, such as 'int', 'image', 'time', etc.
Programmers can implement additional data types. Objects that process custom data types can get initial value and return its different representation; additionally, they can [pre]process format strings.
For example, RVReportSampleFieldObjects unit implements the following additional field types: •num2words – spells a number in English (int to text); for example, '{value num2words}' for value 21 returns 'twenty one'; •uppercase – returns text in upper case (text to text); for example '{name uppercase}' for 'John' returns 'JOHN'; •star – returns an image of a star having as many points as defined in the input value (int to bitmap); this field type processes format strings itself; example: '{value start "size=100 color=red linecolor=blue gradient=1 middlepercent=60"}' •imageinfo – returns text describing the input image (image to text); it returns text like '[Image 250×150]'
Note that a part of this functionality can be implemented using functions for expressions (see below). Moreover, we already added Upper() and SpellNumber() functions. When you need working with text, number, logical and date-time values, functions are preferred. But data types are useful to support additional types of binary data, or additional document formats. |
How to implement Create a class inherited from TRVReportCustomFieldObject. Override the methods: GetValue, GetFieldType. How to register RVReportPluginManager.RegisterFieldObject(<field type name>, <object of your class>); How to unregister RVReportPluginManager.UnRegisterFieldObject(<field type name>, <object of your class>); |
The main way for handing data queries in TRVReportGenerator is assigning a data provider component to its DataProvider property. This data provider is responsible for creating query processors to execute data queries.
Additionally, you can create query processors in OnCreateQueryProcessor event.
There is one more way: to implement a "standard" query processor class and register it for some prefix. After that, prefixed queries will be handled by this class of a query processor.
Standard query processor can use any prefix (consisting of English characters, digits and underscores), except for the reserved 'field' prefix.
For example, RVReportDateTimeQueryProcessor unit implements data queries for 'calendar' prefix. It processes the following types of queries: 1) 'calendar:months' returns 12 months of the year. The result has the following fields: •month – number of month from 1 (int) •name – localized name of the month (text) •short_name – localized shortened name of the month (text) 2) 'calendar:week' returns 7 days of the week (starting from Monday). The result has the following fields: •day_of_week – number of the day of the week from 1 (int) •name – localized name of the day of the week (text) •short_name – localized shortened name of the day of the week (text) 3) 'calendar:days of month M of Y' returns all days of the month M of the year Y (where M is from 1 to 12). The result has the following fields: •day – number of the day in the month, from 1 (int) •day_of_week – number of this day in the week from 1 (int) •week – number of this day's week in the month, from 1 (int) |
How to implement Create a class inherited from TRVReportStandardQueryProcessor. Override the methods: Execute, GetRecordCount, MoveToFirstRecord, MoveToNextRecord: Boolean, MoveBy, IsValidQuery, GetField (two versions), GetFieldType, GetFieldName, GetFieldCount, and some of GetAs*** functions. How to register RegisterClass(<your class>); RVReportPluginManager.RegisterQueryProcessor(<prefix>, <name of your class>); How to unregister RVReportPluginManager.UnRegisterQueryProcessor(<prefix>, <name of your class>); UnRegisterClass(<your class>); |
The main way for handing data queries in TRVReportGenerator is assigning a data provider component to its DataProvider property. This data provider is responsible for creating query processors to execute data queries.
Report Workshop includes TRVReportDBDataProvider component (a universal DB provider that uses TDataSet-based queries), and a set of providers for specific database components sets.
Programmers can implement additional DB-related data provider components (inherited from TRVReportDBDataProvider), or another data provider components (inherited from TRVReportDataProvider).
Data visualizers display diagrams that visualize values at backgrounds of report table cells.
Programmers can implement their own visualizers.
How to implement Create a class inherited from TRVReportCustomValueVisualizer. Override the methods: DisplayValue, GetContentSize. |
Report Workshop provides a set of functions that can be used in expressions.
Programmers can implement additional functions.
For example, RVReportCharCodeCalculator unit implements 'char' function. The parameter is a character code (UTF-32). The result is the character. |
How to implement Create a class inherited from TRVReportCustomExpressionFunctionCalculator. Override the methods: CalculateFunction, GetFunctionArgCount, GetFunctionInfo. How to register RVReportPluginManager.RegisterExpressionFunctionCalculator(<function name>, <object of your class>); How to unregister RVReportPluginManager.UnRegisterExpressionFunctionCalculator(<function name>, <object of your class>); |
Report Workshop provides a set of aggregate functions for cross-tab reports, including 'sum', 'min', 'max', 'average', etc.
Programmers can implement additional functions.
For example, RVReportMedianCalculator unit implements 'median' function. Input data: int or float. Result: float. |
How to implement Create a class inherited from TRVReportCustomAggregateFunctionCalculator. Override the methods: CalculateFunction, GetFunctionFieldType. How to register RVReportPluginManager.RegisterAggregateFunctionCalculator(<function name>, <object of your class>); How to unregister RVReportPluginManager.UnRegisterAggregateFunctionCalculator(<function name>, <object of your class>); |