Robert Mark Bram
Robert Mark Bram

Reputation: 9755

BIRT - using report variable to pass data from outer to inner nested data set

Hoping someone can tell me what is wrong with this BIRT report. I am trying to use a nested scripted data set, where the outer data set passes data to the inner data set through a report variable.

I find that the report isn't acting as I thought it would. It seems as though the report variable is outputting the last value it has for every row. For the below report I am seeing output such as:

key0
  value[9][0]
  value[9][1]
  value[9][2]
  value[9][3]
  value[9][4]

key1
  value[9][0]
  value[9][1]
  value[9][2]
  value[9][3]
  value[9][4]

....

key9
  value[9][0]
  value[9][1]
  value[9][2]
  value[9][3]
  value[9][4]

Whereas I would expect to see this:

key0
  value[0][0]
  value[0][1]
  value[0][2]
  value[0][3]
  value[0][4]

key1
  value[1][0]
  value[1][1]
  value[1][2]
  value[1][3]
  value[1][4]

....

key9
  value[9][0]
  value[9][1]
  value[9][2]
  value[9][3]
  value[9][4]

My (fully self contained) example report is here: click to see report xml in pastebin.

The key idea is that in the outer data set's fetch, I set the report variable:

vars["values"] = value;

And the inner data set's fetch will grab it:

values = vars["values"].iterator();

and the inner data set's fetch will take data from the report variable:

row["value"] = values.next();

Upvotes: 2

Views: 5341

Answers (1)

Michael Williams
Michael Williams

Reputation: 186

You should be able to use dataSet parameters, to do this. In your example, you'd set up an output parameter in the outer data set's dataset editor. You'd set the value of this parameter to be your values you're passing to the other dataSet.

In the inner dataSet, you'd create an input parameter to take the values. In your layout, you'd need to refresh the bindings on the outer list, so that the output parameter is a binding. Then, you'd go to the binding tab, for the inner list, and choose to pass the outer list's output parameter binding to your input parameter.

Hope this helps.

Upvotes: 3

Related Questions