Search code examples
birtxmldatasource

BIRT - Passing Report URL parameters to DataSource URL


I have two servers - one for application(Apache http) and another for BIRT reporting (tomcat). I will have BIRT reports designed with XML Schema files, wherein Datasource URL will be given as

http://localhost/myApp/index.php

Now, the actual URL to access report is as below

http://localhost:8080/birtviewer/frameset?__report=DummyOrder.rptdesign

Now, when is pass a parameter in the Report URL, it should be passed to the Datasource URL, as below:

Report URL: http://localhost:8080/birtviewer/frameset?__report=DummyOrder.rptdesign&OrderNo=101
DataSourceURL: http://localhost/myApp/index.php?OrderNo=101

Is there a way to achieve this??


Solution

  • Double click on your XML-Data-Source and select "property binding" on the left. Enter a function in to the "XML data source file:" field like below:

    if (params["OrderNo"] != null){
     "jdbc:mysql://localhost/myApp/index.php?OrderNo=" + params["OrderNo"];
    }else{
     "jdbc:mysql://localhost/myApp/index.php";
    }
    

    There is also a section in the birt wiki on how to change the data source at runtime.