Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Using report variable to pass data from outer to inner nested data set
Using report variable to pass data from outer to inner nested data set [message #1015947] Mon, 04 March 2013 06:46 Go to next message
Robert Mark Bram is currently offline Robert Mark Bram
Messages: 22
Registered: July 2009
Junior Member
Hi All,

Hoping someone can tell me what is wrong with this 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]


I have attached my (fully self contained) example report. Or you can see it here: http://pastebin.com/aDq0H4ns

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();


Thanks for any assistance!

Rob
Smile

[Updated on: Mon, 04 March 2013 07:05]

Report message to a moderator

Re: Using report variable to pass data from outer to inner nested data set [message #1016042 is a reply to message #1015947] Mon, 04 March 2013 12:07 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

You should be able to do this with dataset parameters. Take a look at the attached example.

Jason
Re: Using report variable to pass data from outer to inner nested data set [message #1016160 is a reply to message #1016042] Tue, 05 March 2013 05:05 Go to previous messageGo to next message
Robert Mark Bram is currently offline Robert Mark Bram
Messages: 22
Registered: July 2009
Junior Member
Thank you Jason - that worked nicely.

Do you know why the report variable didn't work in this case? Why does it seem to evaluate with the last value it was given?

Rob
Smile
Re: Using report variable to pass data from outer to inner nested data set [message #1016308 is a reply to message #1016160] Tue, 05 March 2013 18:52 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

I believe this is a timing issue with the page variable and the data set events. It looks like you are getting the last one in. I generally stay away from putting per row code in the data set (Except the actual script for retrieving data) and instead generally put them on the report item that actually uses the data (In most cases this is a onRow event in a table). Another thing you could try is to use a reportContext.setGlobablVariable function or use the page variable but make it an array with the row number as the element number.

Jason
Re: Using report variable to pass data from outer to inner nested data set [message #1017752 is a reply to message #1016308] Tue, 12 March 2013 09:34 Go to previous message
Robert Mark Bram is currently offline Robert Mark Bram
Messages: 22
Registered: July 2009
Junior Member
Thank you very much for your help Jason. I wrote this up here: Nested Data Sets with Input Parameters in BIRT.
Previous Topic:Alternative charts for birt
Next Topic:Alignment
Goto Forum:
  


Current Time: Wed Jul 30 03:02:35 EDT 2014

Powered by FUDForum. Page generated in 0.02492 seconds