BIRT jdbc dataset. dynamic max row fetch
Question
BIRT report can limit the max row fetch size of a jdbc dataset within the dataset settings. This is a manually entered Integer. I'm looking for a way to pass this dynamically from a ReportParameter to the jdbc dataset to limit the retrieved rows.
I prefer to do this e.g. in the beforeOpen() hook with JavaScript because setting the limit directly in the SQL is DBMS specific and I want the report to run on several DBMS (Oracle, MySQL, DB2, Sybase, ...)
Solution
In the beforeFactory()
hook:
reportContext.getReportRunnable().designHandle.getDesignHandle().findDataSet("Data Set").setRowFetchLimit(params["my_limit"].value);
Generally, a lot of beforeFactory() stuff starts with reportContext.getReportRunnable().designHandle.getDesignHandle()
. You can find here any report element or even traverse all elements if necessary.
When you find()
element, there are not all methods listed in a ctrl+space help. More contain Eclipse Help: BIRT Programmer Reference -> Reference -> API Reference -> Report Object Model API Reference. Class Module Handle is good place to start.
I'm not sure, if there is a shorter dot-chain to access report design handle. If so, please correct me.