gagan
gagan

Reputation: 183

Multiple dataset and java script in BIRT report

I want to create a BIRT report using multiple datasets. This is my requirement:

  1. I will run first query and get some input.
  2. If the input == "A", I want to run the query X, and if input == "b", I will run a query "Y".

This is how I tried to achieve this.

  1. Create "First Data Set" and on "OnFetch", get the value in java script variable.
  2. Create "Second Data Set", and change query on "beforeOpen" using java script.

I am not able to use the java script variable from dataset 1 into dataset 2.

Upvotes: 0

Views: 933

Answers (1)

Dominique
Dominique

Reputation: 4332

You don't provide enough informations about how these datasets are used in the report. Declaring a dataset does not mean it is triggered, actually the first dataset won't be executed until it is invoked by a report element.

Typically, to achieve this we apply following steps:

  • insert a data element at the beginning of the report
  • turn the property visibility of this new element to false
  • bind it to the first dataset.

It will force a silent execution of the first dataset, and therefore it will populate the global variable before the second dataset runs.

However this approach would not work if "Second Dataset" has to be used to populate selection items of a report parameter.

Upvotes: 2

Related Questions