#1 2019-10-10 14:56:12

srpopovic
Member
Registered: 2017-01-18

Datasource parameter assignment to a CSV datasource

Hello

I have a BIRT report and one of the parameters is a Data Source parameter, which should be assigned to a CSV list datasource.

There are 3 datasources on the report server: BIRT datasource, Database datasource and CSV List datasource.

When the BIRT report is loaded on the report server the Data Source parameter is not assigned to the CSV datasource,
only the first datasource is selected, which in this case is the BIRT datasource.

How do I get a CSV list datasource selected for the data source parameter?

The ReportServer API version I am using is 2.2.2.

This is the code I have from importReports.groovy script for Database datasource and BIRT Report datasource assignment
   
private void retrieveBirtReportDatasourceName() {
        birtReportDatasourceName = "";
        def datasources = new XmlSlurper().parse(ClassLoader.getSystemResourceAsStream("datasources.xml") );

        // Get the Birt Report datasource (there is only one)
        datasources.BirtReportDataSources.each
                {
                    it.Datasource.each
                            {
                                birtReportDatasourceName = it.'@name';
                            }
                }
}
// Set the datasource for any datasource parameters belonging to this report
List<ParameterDefinition> reportParams = child.getParameterDefinitions();
for (ParameterDefinition reportParam: reportParams)
{
    if (reportParam instanceof DatasourceParameterDefinition)
    {
        if(it instanceof TableReport)
        {
            if (bReportDatasourceIsSet && !bReportDatasourceIsSetToEmptyKeyword)
            {
                // a. Dynamic Reports have datasource parameters with Database source, not Birt Selection Criteria source
                logger.info("Setting datasource for report parameter: " + reportParam.getKey() + " to datasource: " + ds.getName());
                DatasourceParameterDefinition dsParam = reportParam;

                // b. Set the datasource of the parameter to the Database datasource
                dsParam.getDatasourceContainer().setDatasource(ds);
            }
        }
        else
        {
            // a. Get the Birt Report datasource
            DatasourceDefinition brds = datasourceService.getDatasourceByName(birtReportDatasourceName);

            logger.info("Setting datasource for report parameter: " + reportParam.getKey() + " to datasource: " + brds.getName());
            DatasourceParameterDefinition dsParam = reportParam;

            // b. Set the datasource of the parameter to the Birt Report datasource
            dsParam.getDatasourceContainer().setDatasource(brds);
        }
    }
}

Thanks
Srdjan

Offline

#2 2019-10-15 08:27:09

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Datasource parameter assignment to a CSV datasource

Hi Srdjan,

are you sure you are using reportserver 2.2.2 ? This version is quite old. Do you have a rsversion.properties file ?

Regards,
Eduardo

Offline

#3 2019-10-15 14:29:15

srpopovic
Member
Registered: 2017-01-18

Re: Datasource parameter assignment to a CSV datasource

Hi Eduardo

This is rsversion.properties file content from my report server:

#Fri Mar 04 01:24:06 CET 2016
version=cbn-5801
buildDate=1457051046085-2016-03-04-00-50-50

Regards
Srdjan

Offline

#4 2019-10-18 18:49:24

srpopovic
Member
Registered: 2017-01-18

Re: Datasource parameter assignment to a CSV datasource

Hi Eduardo

You are right, the report server version in my environment is likely 3.0.0 and it was a custom version
built for my company on March 4, 2016 before the official new version was released on March 24, 2016,
which was 3.0.1.

This is the info I've got from my DBA Manager Rong, who requested the custom build around that time:
Ours is not 2.2.2, version 2.2.2 doesn’t have any scripting, importing functions. It’s a function they made for us.

Report server version 3.0 is a combination of GUI improvement, plus scripting interface they made for us.

Hope this helps to clarify the confusion.

Regards
Srdjan

Offline

#5 2019-11-01 09:41:25

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Datasource parameter assignment to a CSV datasource

srpopovic wrote:

When the BIRT report is loaded on the report server the Data Source parameter is not assigned to the CSV datasource,
only the first datasource is selected, which in this case is the BIRT datasource.

I don't quite understand this. Can you please post some screenshots to explain the behavior?

Regards,
Eduardo

Offline

Board footer

Powered by FluxBB