pc1oad1etter
pc1oad1etter

Reputation: 8617

In BIRT, how do I access an arbitrary data set from JavaScript?

I am building my first report in BIRT.

Very quickly I ran into a problem in which I wanted to display some text or data based on an expression that included data from two different tables (not tables that can/should be joined - (hypothetically example- take a student's ACT score from his record in the student table and compare it against the statistics table's entry for ACT statistics). I soon realized that a data element has to be bound to a dataset (only one of them.)

I found a similar question in the BIRT mailing list which helped me get to a solution - I can bind an individual data element to a different dataset, but it can still access the elements of its container. I can send a parameters to the dataset that the element is bound to (e.g. "ACT" in the example I mentioned above).

Eventually however, I came to a place where I needed to use data from three different tables. I am stuck here, and I'm assuming that there is a way to do this through the scripting abilities, but I have yet to see in the documentation a way to extract data from a data set - everything I have dealt with so far is associated with binding a report element to a dataset.

To be clear, I have seen that I can add JavaScript functions to the initialize section of the top level report (and call them from an expression in a data element) but I don't see how in a script I can query any of my datasets -- as opposed to only interacting with the dataset bound to my data element).

How can I access an arbitrary (though already defined) data set from JavaScript in BIRT? (Or how can I access more than two datasets from an element - one that it is bound to, and one that its container is bound to?)

Upvotes: 2

Views: 8915

Answers (2)

kamal079
kamal079

Reputation: 11

Use the

 this.getValue() 
which will return the current column's binding value instead of
 dataSetRow["RUN"]

Upvotes: 1

Scott Rosenbaum
Scott Rosenbaum

Reputation: 671

I have not tried to do this for a while. The immediate answer that pops to mind is that you need to put the third data set into a table (can have visibility set to false) and you would need to populate the table values to a GlobalValue. Then you could get at the GlobalValues from the data control through script.

I know that it is not pretty. I will have a look over the weekend and see if 2.3 has added any functionality that makes this easier.

Upvotes: 2

Related Questions