#1 2013-11-22 15:07:14

tristan
Member
Registered: 2013-11-14

Dynamic Report Paramerers in BiRT

We have a number of reports written in BiRT that use dynamic report parameters - basically a set of dropdowns whose values are selected from the database.
These parameters are defined in the BiRT .rptdesign file.

For example, the .rptdesign file has sections like this:

<scalar-parameter name="Campaign" id="415">
            <text-property name="promptText">Select Campaign</text-property>
            <property name="valueType">dynamic</property>
            <property name="dataSetName">Campaigns</property>
            <expression name="valueExpr" type="javascript">dataSetRow["id"]</expression>
            <expression name="labelExpr" type="javascript">dataSetRow["campaignName"]</expression>
            <property name="dataType">integer</property>
            <property name="distinct">true</property>
            <list-property name="selectionList"/>
            <property name="paramType">simple</property>
            <property name="controlType">list-box</property>
            <property name="mustMatch">true</property>
            <property name="fixedOrder">true</property>
            <structure name="format">
                <property name="category">Unformatted</property>
            </structure>
</scalar-parameter>


and


<oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" name="Campaigns" id="414">
            ...
            <list-property name="resultSet">
                <structure>
                    <property name="position">1</property>
                    <property name="name">id</property>
                    <property name="nativeName">Campaign ID</property>
                    <property name="dataType">integer</property>
                    <property name="nativeDataType">4</property>
                </structure>
                <structure>
                    <property name="position">2</property>
                    <property name="name">campaignName</property>
                    <property name="nativeName">Campaign Name</property>
                    <property name="dataType">string</property>
                    <property name="nativeDataType">12</property>
                </structure>
            </list-property>
            <xml-property name="queryText"><![CDATA[select campaigns.id, campaigns.campaignName from campaigns]]></xml-property>
            ...
</ods-data-set>


If I load the reports into ReportServer and hit the "Extract Parameters" button, the campaign parameter is extracted, but as a text box.
Is there any way to make these parameters work properly using the definitions in the .rptdesign file?

Offline

#2 2013-11-22 16:05:13

Thorsten J. Krause
datenwerke
Registered: 2012-02-15
Website

Re: Dynamic Report Paramerers in BiRT

Hi Tristan,

the extract parameters function is rather basic and does not correctly set the parameters type, but you can always create the parameters manually.

To use a parameter that has its values populated from a datasource defined in your report, you first have to create a new datasource of type "Birt Report Datasource" in the Datasources section of ReportServer admin module. You only have to do this once and henceforth can use this datasource for any number of reports.

Afterward, in the parameters section for your report in ReportServer, add a new parameter of type "Datasource Parameter". Assign the key used in your rptdesign file and edit the parameters properties by doubleclicking. Under "specific properties" select the datasource you just created and adjust the setting to point to datasource defined in your report file (type=dataset, name=Campaigns). If you leave the report field empty, the current report is assumed.

Cheers,
Thorsten

Offline

#3 2013-11-25 09:36:54

tristan
Member
Registered: 2013-11-14

Re: Dynamic Report Paramerers in BiRT

Hi Thorsten,

The thing is that I don't want to use the datasource defined in my .rptdesign since this typically points to the report designer's localhost.
I want to use the production datasource that is defined in the "Datasources" section of ReportServer - and this works perfectly as far as the report goes.

The question is whether there is any way to get ReportServer to render the dropdown box with the list of values (from the SQL defined in the .rptdesign file) using the production datasource?

Regards,

Tristan

Offline

#4 2013-11-25 23:40:26

Thorsten J. Krause
datenwerke
Registered: 2012-02-15
Website

Re: Dynamic Report Paramerers in BiRT

Hi Tristan,

I might have mixed up the terms Datasource and Dataset so my last reply was probably a little confusing.
Let me give you some more details and hopefully explain things better:

Dynamic (data driven) parameters in ReportServer are available by means of the Datasource Paramter. The usual way to use this parameter is to link it to a (ReportServer-)datasource and assign a sql-query expression.

As in most cases it's not desirable to maintain the parameter query in two seperate places (ReportServer and the .rptdesign file) the method I described in my last post allows ReportServer to access a dataset that was defined in the .rptdesign file and use its values for the parameter.

None of this has any influence on the database connection used. Whenever a datasource is assigned to the report in ReportServer, this datasource will replace all datasources defined in the .rptdesign itself and all datasets from the .rptdesign will use the datasource that was passed in.

Cheers,
Thorsten

Offline

#5 2013-11-26 11:10:18

tristan
Member
Registered: 2013-11-14

Re: Dynamic Report Paramerers in BiRT

Hi Thorsten,

Thats what I tried after your original post, but I couldn't get it to work. What I did was as follows:

1. Went to datasources and created a new "Birt Report Datasource" called "Test". There is no configuration that I can perform on this datasource except to give it a name/description and assign permissions.
2. Went to my report and created a new "Datasource Parameter" with key = "Campaign" and name = "Campaign". This key corresponds to the parameter name in my .rptdesign.
3. In "Specific Properties", I set
  - datasource = "Test" (created in (1))
  - name = "Campaign"
4. If I set "type" to "parameter", no data is returned. If I set type to "Dataset", I get the error "The report could not be executed. Could not find the target Campaign".

Is there a step that I am missing?

Regards,

Tristan

Offline

#6 2013-11-26 22:54:51

Thorsten J. Krause
datenwerke
Registered: 2012-02-15
Website

Re: Dynamic Report Paramerers in BiRT

Hi Tristan,

might the issue just be a typo? The name used in step 3 should be the name of the dataset, i.e. Campaigns (plural).

Cheers,
Thorsten

Offline

#7 2013-11-28 11:03:30

tristan
Member
Registered: 2013-11-14

Re: Dynamic Report Paramerers in BiRT

Hi Thorsten,

No. Unfortunately not a typo. Just can't get it to work.
I am now wondering if there is a problem with my installation since I am also having issues with expression parameters on the dynamic lists.

Regards,

Tristan

Offline

#8 2013-11-28 13:50:48

Thorsten J. Krause
datenwerke
Registered: 2012-02-15
Website

Re: Dynamic Report Paramerers in BiRT

Hi Tristan,

you may be right, at least something is really suspicious here. I looked into the report definition you send me, and there is nothing wrong with it. If I create tables with the appropriate columns I can run it without any problem. I'm not sure, what to make of this, yet. I'll talk to some of my colleagues and come back to you.

Cheers,
Thorsten

Offline

#9 2013-12-02 13:18:08

tristan
Member
Registered: 2013-11-14

Re: Dynamic Report Paramerers in BiRT

Hi Thorsten,

Problem solved. Our production server was still running Tomcat v6 which only has the EL v2.1 library.
Upgrading to Tomcat 7 with EL2.2 sorted it out.

Regards,

Tristan

Offline

#10 2013-12-03 00:02:22

Thorsten J. Krause
datenwerke
Registered: 2012-02-15
Website

Re: Dynamic Report Paramerers in BiRT

Hi Tristan,

thank you for letting us know! Thats certainly something someone else will eventually run into, too.

Offline

Board footer

Powered by FluxBB