Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Aggregated value of dataset in global variable
Aggregated value of dataset in global variable [message #528369] Tue, 20 April 2010 09:39 Go to next message
Helmut Neubauer is currently offline Helmut NeubauerFriend
Messages: 54
Registered: July 2009
Member
Hello,

I have a dataset with two columns. I'd like to store the aggregated
maximum of one column in a global variable, so I can reuse it in another
dataset to compute a new column (I can't join the data sets because
there is no possible column for joining).

How can I do this? Please help. Thanks,
Helmut
Re: Aggregated value of dataset in global variable [message #528530 is a reply to message #528369] Tue, 20 April 2010 20:10 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Helmut,

You should be able to still do a full outer join on two unrelated
columns. This will just combine both datasets.

On the script side if you are displaying the aggregate, in its onCreate
script you can get its value this.getValue and store it in a global
variable to reference later in another table.

reportContext.setPersistentGlobalVariable (Must be used if some variable
is needed in run and render phases of report creation)
or
reportContext.setGlobalVariable ( Ok if all variable usage is only in
run portion)

Jason

Helmut Neubauer wrote:
> Hello,
>
> I have a dataset with two columns. I'd like to store the aggregated
> maximum of one column in a global variable, so I can reuse it in another
> dataset to compute a new column (I can't join the data sets because
> there is no possible column for joining).
>
> How can I do this? Please help. Thanks,
> Helmut
Re: Aggregated value of dataset in global variable [message #528626 is a reply to message #528530] Wed, 21 April 2010 10:21 Go to previous messageGo to next message
Helmut Neubauer is currently offline Helmut NeubauerFriend
Messages: 54
Registered: July 2009
Member
Jason,

thanks for your answer. I tried your first proposal and it works :). I
didn't know I can join two unrelated columns. I think this isn't the
normal behaviour of outer joins (considering database joins). So I don't
understand the whole concept of the outer joins in BIRT. Normally there
shoudn't be a result, shoudn't it?

I cound' try the second proposal, because I have the data of the first
data set only in a chart, not in a table. How can I do this in a chart?

Thanks,
Helmut

Jason Weathersby schrieb:
> Helmut,
>
> You should be able to still do a full outer join on two unrelated
> columns. This will just combine both datasets.
>
> On the script side if you are displaying the aggregate, in its onCreate
> script you can get its value this.getValue and store it in a global
> variable to reference later in another table.
>
> reportContext.setPersistentGlobalVariable (Must be used if some variable
> is needed in run and render phases of report creation)
> or
> reportContext.setGlobalVariable ( Ok if all variable usage is only in
> run portion)
>
> Jason
>
> Helmut Neubauer wrote:
>> Hello,
>>
>> I have a dataset with two columns. I'd like to store the aggregated
>> maximum of one column in a global variable, so I can reuse it in another
>> dataset to compute a new column (I can't join the data sets because
>> there is no possible column for joining).
>>
>> How can I do this? Please help. Thanks,
>> Helmut
Re: Aggregated value of dataset in global variable [message #528783 is a reply to message #528626] Wed, 21 April 2010 17:59 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

The way it works in BIRT is it essentially just adds rows because it
does not find a join. If it found any rows in the first dataset that
matched the key of the second dataset the rows would combine to create
one row. So for example if you have 2 datasets each with 5 rows and no
key matches then you will get 10 rows back. If you had 2 matches you
would get 8 rows back.


You could access the report context from chart script, but these do not
run until render time which will be to late to use in the generation
phase for normal BIRT elements. Chart creation actually happens in the
report rendering phase. Table elements are created in the generation
phase. To get around this you could drop a table above the chart and
sets its visibility to hide it. It will still run so you can do
scripting on it and use the values elsewhere in the report.

Jason


Helmut Neubauer wrote:
> Jason,
>
> thanks for your answer. I tried your first proposal and it works :). I
> didn't know I can join two unrelated columns. I think this isn't the
> normal behaviour of outer joins (considering database joins). So I don't
> understand the whole concept of the outer joins in BIRT. Normally there
> shoudn't be a result, shoudn't it?
>
> I cound' try the second proposal, because I have the data of the first
> data set only in a chart, not in a table. How can I do this in a chart?
>
> Thanks,
> Helmut
>
> Jason Weathersby schrieb:
>> Helmut,
>>
>> You should be able to still do a full outer join on two unrelated
>> columns. This will just combine both datasets.
>>
>> On the script side if you are displaying the aggregate, in its onCreate
>> script you can get its value this.getValue and store it in a global
>> variable to reference later in another table.
>>
>> reportContext.setPersistentGlobalVariable (Must be used if some variable
>> is needed in run and render phases of report creation)
>> or
>> reportContext.setGlobalVariable ( Ok if all variable usage is only in
>> run portion)
>>
>> Jason
>>
>> Helmut Neubauer wrote:
>>> Hello,
>>>
>>> I have a dataset with two columns. I'd like to store the aggregated
>>> maximum of one column in a global variable, so I can reuse it in another
>>> dataset to compute a new column (I can't join the data sets because
>>> there is no possible column for joining).
>>>
>>> How can I do this? Please help. Thanks,
>>> Helmut
Previous Topic:Create report using Java
Next Topic:Reverse table
Goto Forum:
  


Current Time: Fri Apr 26 11:04:14 GMT 2024

Powered by FUDForum. Page generated in 0.03401 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top