开发者

Birt parameter and dataset

开发者 https://www.devze.com 2023-03-15 15:09 出处:网络
I would like to show a report using a parameter, depending what parameter the user chose It should show a specific dataset. is that possible?

I would like to show a report using a parameter, depending what parameter the user chose It should show a specific dataset. is that possible?

This is why i need to show different DATASETS depending on the value chosen in the parameter:

I have a report and I need to integrate it in one if possible. This report have the parameters of start and finish date, but now also want to have a service parameter. For example i need a report to shows me clients that are related to service A, the available services are : A,B,C,D,E so that's why I'm using service as parameter, but the same report depending on what service it is, changes and needs to show not only clients but also employees related to the service.

i.e.

Report 1 : Show clients related to service A

Report 2 : Show clients related to service B

Report 3 : Show clients and employees related to service C

Report 4 : Show clients related to service D

Report 开发者_开发百科5 : Show clients and employees related to service E


If data set has to be swapped during runtime:

  1. Name report item bound to one of data sets in the Property Editor view, i.e. to myTable.
  2. In the beforeFactory script assign appropriate Data Set:

    var myTable = reportContext.getDesignHandle().findElement('myTable');
    myTable.setProperty('dataSet', 'myChoosenDataSet');
    

Another, simpler approach: if it will be sufficient, you can just hide data items when not needed. Put a visibility condition in the Property Editor view, for the item to be hidden.

Yet another approach: adjust sql query in the Data Set beforeOpen script:

if (params['service'].value == 'foo') {
    this.queryText = "select * from foo where foo.bar = ?";
}
0

精彩评论

暂无评论...
验证码 换一张
取 消