Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Access the value of a computed column of a dataset in a script
Access the value of a computed column of a dataset in a script [message #900740] Wed, 08 August 2012 07:11 Go to next message
Rupal Biyani is currently offline Rupal Biyani
Messages: 8
Registered: July 2012
Junior Member
Hi,

I have added a data element to one of the column of the grid.In the onRender script of the data element , i want to access the value of a computed column of a particular datset.
I tried doing something like this:
temp=reportContext.getDesignHandle().findDataSet("Design Defects Not found in Design Phase").computedColumnsIterator().next();
this.setDisplayValue(temp);

But this script only fetches me the object, not the value.

Can you please help me on how to access the value of a computed data column from the script.

Thanks!
Rupal
Re: Access the value of a computed column of a dataset in a script [message #900818 is a reply to message #900740] Wed, 08 August 2012 11:33 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

That iterator will only get you the design not the values. Is you data
item bound to a dataset or is the grid? In either case add the computed
column to the binding and just reference it like:

this.setDisplayValue(this.getRowData().getColumnValue("COMPUTEDCOLUMNBINDINGNAME"));

See attached example

Jason

On 8/8/2012 7:11 AM, Rupal Biyani wrote:
> Hi,
>
> I have added a data element to one of the column of the grid.In the
> onRender script of the data element , i want to access the value of a
> computed column of a particular datset.
> I tried doing something like this:
> temp=reportContext.getDesignHandle().findDataSet("Design Defects Not
> found in Design Phase").computedColumnsIterator().next();
> this.setDisplayValue(temp);
>
> But this script only fetches me the object, not the value.
>
> Can you please help me on how to access the value of a computed data
> column from the script.
>
> Thanks!
> Rupal
Re: Access the value of a computed column of a dataset in a script [message #901148 is a reply to message #900818] Fri, 10 August 2012 01:26 Go to previous messageGo to next message
Rupal Biyani is currently offline Rupal Biyani
Messages: 8
Registered: July 2012
Junior Member
Jason Weathersby wrote on Wed, 08 August 2012 11:33
That iterator will only get you the design not the values. Is you data
item bound to a dataset or is the grid? In either case add the computed
column to the binding and just reference it like:

this.setDisplayValue(this.getRowData().getColumnValue("COMPUTEDCOLUMNBINDINGNAME"));

See attached example

Jason

On 8/8/2012 7:11 AM, Rupal Biyani wrote:
> Hi,
>
> I have added a data element to one of the column of the grid.In the
> onRender script of the data element , i want to access the value of a
> computed column of a particular datset.
> I tried doing something like this:
> temp=reportContext.getDesignHandle().findDataSet("Design Defects Not
> found in Design Phase").computedColumnsIterator().next();
> this.setDisplayValue(temp);
>
> But this script only fetches me the object, not the value.
>
> Can you please help me on how to access the value of a computed data
> column from the script.
>
> Thanks!
> Rupal


Jason,

My requirement is as follows:

I need to display the values of various project metrics in a grid.
This project metric is a ratio,where the numerator and denominator comes from two different data sets.But since we can attach, only one datset to an element.I cannot calculate the ratio.
Right now i have made a invisible grid with many tables, that stores the values of these numerators and denominators and then in the final grid using OnRender script, i calculate the values.

I wanted to ask is there any other way through which we can do this?
I am attaching the file for your reference.
Re: Access the value of a computed column of a dataset in a script [message #901613 is a reply to message #901148] Mon, 13 August 2012 12:22 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Yes but first do the datasets return more than one row?

Jason

On 8/10/2012 1:26 AM, Rupal Biyani wrote:
> Jason Weathersby wrote on Wed, 08 August 2012 11:33
>> That iterator will only get you the design not the values. Is you data
>> item bound to a dataset or is the grid? In either case add the computed
>> column to the binding and just reference it like:
>>
>> this.setDisplayValue(this.getRowData().getColumnValue("COMPUTEDCOLUMNBINDINGNAME"));
>>
>> See attached example
>>
>> Jason
>>
>> On 8/8/2012 7:11 AM, Rupal Biyani wrote:
>>> Hi,
>>>
>>> I have added a data element to one of the column of the grid.In the
>>> onRender script of the data element , i want to access the value of a
>>> computed column of a particular datset.
>>> I tried doing something like this:
>>> temp=reportContext.getDesignHandle().findDataSet("Design Defects Not
>>> found in Design Phase").computedColumnsIterator().next();
>>> this.setDisplayValue(temp);
>>>
>>> But this script only fetches me the object, not the value.
>>>
>>> Can you please help me on how to access the value of a computed data
>>> column from the script.
>>>
>>> Thanks!
>>> Rupal
>
>
> Jason,
>
> My requirement is as follows:
>
> I need to display the values of various project metrics in a grid.
> This project metric is a ratio,where the numerator and denominator comes from two different data sets.But since we can attach, only one datset to an element.I cannot calculate the ratio.
> Right now i have made a invisible grid with many tables, that stores the values of these numerators and denominators and then in the final grid using OnRender script, i calculate the values.
>
> I wanted to ask is there any other way through which we can do this?
> I am attaching the file for your reference.
>
Re: Access the value of a computed column of a dataset in a script [message #901616 is a reply to message #901613] Mon, 13 August 2012 12:27 Go to previous message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

You can always bind one dataset to the grid and one to the data item and
then reference the outer one within the data expression. See attached.

Jason

On 8/13/2012 12:22 PM, Jason Weathersby wrote:
> Yes but first do the datasets return more than one row?
>
> Jason
>
> On 8/10/2012 1:26 AM, Rupal Biyani wrote:
>> Jason Weathersby wrote on Wed, 08 August 2012 11:33
>>> That iterator will only get you the design not the values. Is you data
>>> item bound to a dataset or is the grid? In either case add the computed
>>> column to the binding and just reference it like:
>>>
>>> this.setDisplayValue(this.getRowData().getColumnValue("COMPUTEDCOLUMNBINDINGNAME"));
>>>
>>>
>>> See attached example
>>>
>>> Jason
>>>
>>> On 8/8/2012 7:11 AM, Rupal Biyani wrote:
>>>> Hi,
>>>>
>>>> I have added a data element to one of the column of the grid.In the
>>>> onRender script of the data element , i want to access the value of a
>>>> computed column of a particular datset.
>>>> I tried doing something like this:
>>>> temp=reportContext.getDesignHandle().findDataSet("Design Defects Not
>>>> found in Design Phase").computedColumnsIterator().next();
>>>> this.setDisplayValue(temp);
>>>>
>>>> But this script only fetches me the object, not the value.
>>>>
>>>> Can you please help me on how to access the value of a computed data
>>>> column from the script.
>>>>
>>>> Thanks!
>>>> Rupal
>>
>>
>> Jason,
>>
>> My requirement is as follows:
>>
>> I need to display the values of various project metrics in a grid.
>> This project metric is a ratio,where the numerator and denominator
>> comes from two different data sets.But since we can attach, only one
>> datset to an element.I cannot calculate the ratio.
>> Right now i have made a invisible grid with many tables, that stores
>> the values of these numerators and denominators and then in the final
>> grid using OnRender script, i calculate the values.
>>
>> I wanted to ask is there any other way through which we can do this?
>> I am attaching the file for your reference.
>>
>
Previous Topic:Birt POJO's as DataSource?
Next Topic:Print Report --> Empty page
Goto Forum:
  


Current Time: Fri Aug 29 10:17:53 EDT 2014

Powered by FUDForum. Page generated in 0.01991 seconds