Skip to main content



      Home
Home » Archived » BIRT » Data Set Result used as Variable
Data Set Result used as Variable [message #252151] Mon, 13 August 2007 09:58 Go to next message
Eclipse UserFriend
Originally posted by: Jeff.thisplace.com

Hello:

I have a data set which calculates a sum() and returns a single value. I
would like to use this value when selecting data from "another" data set in
a chart. I cannot find a way to get access to the sum() data set value when
I am using another data set in a chart.

Does anyone have an idea on how to do this?

Thanks,

Jeff
Re: Data Set Result used as Variable [message #252166 is a reply to message #252151] Mon, 13 August 2007 11:36 Go to previous messageGo to next message
Eclipse UserFriend
One way of doing this is to assign the sum to a hidden parameter. Then use
that parameter in the prepared statement query of the other dataset.

For e.g.,

In the onFetch method of your first dataset that computes the sum, store
the sum in a hidden parameter X
In the second dataset write your query as select <col names> from <table
name> where <col name> = ? Bind the question mark to the parameter X

-pc

"Jeff" <Jeff@thisplace.com> wrote in message
news:f9po1m$uhm$1@build.eclipse.org...
> Hello:
>
> I have a data set which calculates a sum() and returns a single value. I
> would like to use this value when selecting data from "another" data set
> in a chart. I cannot find a way to get access to the sum() data set value
> when I am using another data set in a chart.
>
> Does anyone have an idea on how to do this?
>
> Thanks,
>
> Jeff
>
Re: Data Set Result used as Variable [message #252169 is a reply to message #252166] Mon, 13 August 2007 11:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Jeff.thisplace.com

Hi:

This sounds like a good approach. I tried to use a new parameter on the
dataset, but can't seem to set the parameter. The only direction option I
have is "input". No "output" available. Is there another way to set the
value of the hidden report parameter?

Thanks,

Jeff


"chakravp" <chakravp@us.ibm.com> wrote in message
news:f9ptj8$hg3$1@build.eclipse.org...
> One way of doing this is to assign the sum to a hidden parameter. Then use
> that parameter in the prepared statement query of the other dataset.
>
> For e.g.,
>
> In the onFetch method of your first dataset that computes the sum, store
> the sum in a hidden parameter X
> In the second dataset write your query as select <col names> from <table
> name> where <col name> = ? Bind the question mark to the parameter X
>
> -pc
>
> "Jeff" <Jeff@thisplace.com> wrote in message
> news:f9po1m$uhm$1@build.eclipse.org...
>> Hello:
>>
>> I have a data set which calculates a sum() and returns a single value. I
>> would like to use this value when selecting data from "another" data set
>> in a chart. I cannot find a way to get access to the sum() data set
>> value when I am using another data set in a chart.
>>
>> Does anyone have an idea on how to do this?
>>
>> Thanks,
>>
>> Jeff
>>
>
>
Re: Data Set Result used as Variable [message #252173 is a reply to message #252169] Mon, 13 August 2007 12:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Jeff.thisplace.com

I just found in the docs that "output" parameters are only supported for
stored procedures. I'm not sure what this refers to. I have a simple SQL
statement which sums a column and returns one value. How do I get to a
stored procedure from here to support seeting the value of a report
parameter?

Thanks,

Jeff


"Jeff" <Jeff@thisplace.com> wrote in message
news:f9puuv$rvk$1@build.eclipse.org...
> Hi:
>
> This sounds like a good approach. I tried to use a new parameter on the
> dataset, but can't seem to set the parameter. The only direction option I
> have is "input". No "output" available. Is there another way to set the
> value of the hidden report parameter?
>
> Thanks,
>
> Jeff
>
>
> "chakravp" <chakravp@us.ibm.com> wrote in message
> news:f9ptj8$hg3$1@build.eclipse.org...
>> One way of doing this is to assign the sum to a hidden parameter. Then
>> use that parameter in the prepared statement query of the other dataset.
>>
>> For e.g.,
>>
>> In the onFetch method of your first dataset that computes the sum, store
>> the sum in a hidden parameter X
>> In the second dataset write your query as select <col names> from <table
>> name> where <col name> = ? Bind the question mark to the parameter X
>>
>> -pc
>>
>> "Jeff" <Jeff@thisplace.com> wrote in message
>> news:f9po1m$uhm$1@build.eclipse.org...
>>> Hello:
>>>
>>> I have a data set which calculates a sum() and returns a single value.
>>> I would like to use this value when selecting data from "another" data
>>> set in a chart. I cannot find a way to get access to the sum() data set
>>> value when I am using another data set in a chart.
>>>
>>> Does anyone have an idea on how to do this?
>>>
>>> Thanks,
>>>
>>> Jeff
>>>
>>
>>
>
>
Re: Data Set Result used as Variable [message #252185 is a reply to message #252173] Mon, 13 August 2007 13:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Jeff.thisplace.com

An update on progress...

I am now obtaining the value from a stored procedure from within the DB.
This has enabled the ability to work with the data set parameter as an
output. However, when this is selected, the options to bind the output to a
report parameter become disabled.

Does anyone know how to bind a result to a report parameter?

Thanks,

Jeff


"Jeff" <Jeff@thisplace.com> wrote in message
news:f9pvcn$uke$1@build.eclipse.org...
>I just found in the docs that "output" parameters are only supported for
>stored procedures. I'm not sure what this refers to. I have a simple SQL
>statement which sums a column and returns one value. How do I get to a
>stored procedure from here to support seeting the value of a report
>parameter?
>
> Thanks,
>
> Jeff
>
>
> "Jeff" <Jeff@thisplace.com> wrote in message
> news:f9puuv$rvk$1@build.eclipse.org...
>> Hi:
>>
>> This sounds like a good approach. I tried to use a new parameter on the
>> dataset, but can't seem to set the parameter. The only direction option
>> I have is "input". No "output" available. Is there another way to set
>> the value of the hidden report parameter?
>>
>> Thanks,
>>
>> Jeff
>>
>>
>> "chakravp" <chakravp@us.ibm.com> wrote in message
>> news:f9ptj8$hg3$1@build.eclipse.org...
>>> One way of doing this is to assign the sum to a hidden parameter. Then
>>> use that parameter in the prepared statement query of the other dataset.
>>>
>>> For e.g.,
>>>
>>> In the onFetch method of your first dataset that computes the sum,
>>> store the sum in a hidden parameter X
>>> In the second dataset write your query as select <col names> from <table
>>> name> where <col name> = ? Bind the question mark to the parameter X
>>>
>>> -pc
>>>
>>> "Jeff" <Jeff@thisplace.com> wrote in message
>>> news:f9po1m$uhm$1@build.eclipse.org...
>>>> Hello:
>>>>
>>>> I have a data set which calculates a sum() and returns a single value.
>>>> I would like to use this value when selecting data from "another" data
>>>> set in a chart. I cannot find a way to get access to the sum() data
>>>> set value when I am using another data set in a chart.
>>>>
>>>> Does anyone have an idea on how to do this?
>>>>
>>>> Thanks,
>>>>
>>>> Jeff
>>>>
>>>
>>>
>>
>>
>
>
Re: Data Set Result used as Variable [message #252201 is a reply to message #252166] Mon, 13 August 2007 14:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Jeff.thisplace.com

I've located the onFetch method for the data source. How would I go about
assigning the result set to a hidden paramter? I can't seem to find any
examples.

Thanks,

Jeff


"chakravp" <chakravp@us.ibm.com> wrote in message
news:f9ptj8$hg3$1@build.eclipse.org...
> One way of doing this is to assign the sum to a hidden parameter. Then use
> that parameter in the prepared statement query of the other dataset.
>
> For e.g.,
>
> In the onFetch method of your first dataset that computes the sum, store
> the sum in a hidden parameter X
> In the second dataset write your query as select <col names> from <table
> name> where <col name> = ? Bind the question mark to the parameter X
>
> -pc
>
> "Jeff" <Jeff@thisplace.com> wrote in message
> news:f9po1m$uhm$1@build.eclipse.org...
>> Hello:
>>
>> I have a data set which calculates a sum() and returns a single value. I
>> would like to use this value when selecting data from "another" data set
>> in a chart. I cannot find a way to get access to the sum() data set
>> value when I am using another data set in a chart.
>>
>> Does anyone have an idea on how to do this?
>>
>> Thanks,
>>
>> Jeff
>>
>
>
Re: Data Set Result used as Variable [message #252227 is a reply to message #252185] Mon, 13 August 2007 17:37 Go to previous messageGo to next message
Eclipse UserFriend
Jeff,

You don't need to make the report parameter an output.

First create a parameter for your report (not in your dataset, but on your
report, in the Report Parameters section). Say this parameter is called X.
When you create the parameter make sure the "Hidden" checkbox is checked.

Next, let us assume you have a dataset DS1 which returns a column called
SUM. From your earlier post, it seems like there will be only one value
returned by your dataset i.e., the result will have one column and one row.
In the onFetch method of the dataset DS1, assign the value of this SUM to
the parameter X by typing this code:

params["X"]=row.getColumnValue("SUM");

Now write your query for the second dataset say DS2. The query should be
select <col_names> from <table_name> where <col_name> = ?
Bind the question mark to the parameter X. In order to do that, go to the
parameters in the dataset editor once you have entered the query and select
"X" for the Link to Report Parameter box.

Now bind DS1 with a blank label and make this invisible. The label should be
placed before the chart. When this element gets loaded, DS1 is called, SUM
is computed and assigned to parameter X. Next when the chart is called which
is bound to DS2, DS2 will use the value of parameter X.

This way the value from one dataset can be fed to another dataset by using a
parameter that remains hidden.
Though this works, there might be a better way to handle this with your
query.

-pc
"Jeff" <Jeff@thisplace.com> wrote in message
news:f9q5au$rp0$1@build.eclipse.org...
> An update on progress...
>
> I am now obtaining the value from a stored procedure from within the DB.
> This has enabled the ability to work with the data set parameter as an
> output. However, when this is selected, the options to bind the output to
> a report parameter become disabled.
>
> Does anyone know how to bind a result to a report parameter?
>
> Thanks,
>
> Jeff
>
>
> "Jeff" <Jeff@thisplace.com> wrote in message
> news:f9pvcn$uke$1@build.eclipse.org...
>>I just found in the docs that "output" parameters are only supported for
>>stored procedures. I'm not sure what this refers to. I have a simple SQL
>>statement which sums a column and returns one value. How do I get to a
>>stored procedure from here to support seeting the value of a report
>>parameter?
>>
>> Thanks,
>>
>> Jeff
>>
>>
>> "Jeff" <Jeff@thisplace.com> wrote in message
>> news:f9puuv$rvk$1@build.eclipse.org...
>>> Hi:
>>>
>>> This sounds like a good approach. I tried to use a new parameter on the
>>> dataset, but can't seem to set the parameter. The only direction option
>>> I have is "input". No "output" available. Is there another way to set
>>> the value of the hidden report parameter?
>>>
>>> Thanks,
>>>
>>> Jeff
>>>
>>>
>>> "chakravp" <chakravp@us.ibm.com> wrote in message
>>> news:f9ptj8$hg3$1@build.eclipse.org...
>>>> One way of doing this is to assign the sum to a hidden parameter. Then
>>>> use that parameter in the prepared statement query of the other
>>>> dataset.
>>>>
>>>> For e.g.,
>>>>
>>>> In the onFetch method of your first dataset that computes the sum,
>>>> store the sum in a hidden parameter X
>>>> In the second dataset write your query as select <col names> from
>>>> <table name> where <col name> = ? Bind the question mark to the
>>>> parameter X
>>>>
>>>> -pc
>>>>
>>>> "Jeff" <Jeff@thisplace.com> wrote in message
>>>> news:f9po1m$uhm$1@build.eclipse.org...
>>>>> Hello:
>>>>>
>>>>> I have a data set which calculates a sum() and returns a single value.
>>>>> I would like to use this value when selecting data from "another" data
>>>>> set in a chart. I cannot find a way to get access to the sum() data
>>>>> set value when I am using another data set in a chart.
>>>>>
>>>>> Does anyone have an idea on how to do this?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Jeff
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Re: Data Set Result used as Variable [message #252247 is a reply to message #252227] Mon, 13 August 2007 20:11 Go to previous message
Eclipse UserFriend
Originally posted by: Jeff.thisplace.com

PC:

Thanks for the direction on this. I managed to get it to work, with one
minor adjustment. When I call row.getColumnValue, I get an error that
states the method does not exist. Kind of wierd to since the context help
indicates the method is there. I did a search on this, and found others
having the same problem. row["column_name"]; did the trick.

Thanks again for your help!

Jeff


"chakravp" <chakravp@us.ibm.com> wrote in message
news:f9qio6$qr3$1@build.eclipse.org...
> Jeff,
>
> You don't need to make the report parameter an output.
>
> First create a parameter for your report (not in your dataset, but on your
> report, in the Report Parameters section). Say this parameter is called X.
> When you create the parameter make sure the "Hidden" checkbox is checked.
>
> Next, let us assume you have a dataset DS1 which returns a column called
> SUM. From your earlier post, it seems like there will be only one value
> returned by your dataset i.e., the result will have one column and one
> row.
> In the onFetch method of the dataset DS1, assign the value of this SUM to
> the parameter X by typing this code:
>
> params["X"]=row.getColumnValue("SUM");
>
> Now write your query for the second dataset say DS2. The query should be
> select <col_names> from <table_name> where <col_name> = ?
> Bind the question mark to the parameter X. In order to do that, go to the
> parameters in the dataset editor once you have entered the query and
> select "X" for the Link to Report Parameter box.
>
> Now bind DS1 with a blank label and make this invisible. The label should
> be placed before the chart. When this element gets loaded, DS1 is called,
> SUM is computed and assigned to parameter X. Next when the chart is called
> which is bound to DS2, DS2 will use the value of parameter X.
>
> This way the value from one dataset can be fed to another dataset by using
> a parameter that remains hidden.
> Though this works, there might be a better way to handle this with your
> query.
>
> -pc
> "Jeff" <Jeff@thisplace.com> wrote in message
> news:f9q5au$rp0$1@build.eclipse.org...
>> An update on progress...
>>
>> I am now obtaining the value from a stored procedure from within the DB.
>> This has enabled the ability to work with the data set parameter as an
>> output. However, when this is selected, the options to bind the output
>> to a report parameter become disabled.
>>
>> Does anyone know how to bind a result to a report parameter?
>>
>> Thanks,
>>
>> Jeff
>>
>>
>> "Jeff" <Jeff@thisplace.com> wrote in message
>> news:f9pvcn$uke$1@build.eclipse.org...
>>>I just found in the docs that "output" parameters are only supported for
>>>stored procedures. I'm not sure what this refers to. I have a simple
>>>SQL statement which sums a column and returns one value. How do I get to
>>>a stored procedure from here to support seeting the value of a report
>>>parameter?
>>>
>>> Thanks,
>>>
>>> Jeff
>>>
>>>
>>> "Jeff" <Jeff@thisplace.com> wrote in message
>>> news:f9puuv$rvk$1@build.eclipse.org...
>>>> Hi:
>>>>
>>>> This sounds like a good approach. I tried to use a new parameter on
>>>> the dataset, but can't seem to set the parameter. The only direction
>>>> option I have is "input". No "output" available. Is there another way
>>>> to set the value of the hidden report parameter?
>>>>
>>>> Thanks,
>>>>
>>>> Jeff
>>>>
>>>>
>>>> "chakravp" <chakravp@us.ibm.com> wrote in message
>>>> news:f9ptj8$hg3$1@build.eclipse.org...
>>>>> One way of doing this is to assign the sum to a hidden parameter. Then
>>>>> use that parameter in the prepared statement query of the other
>>>>> dataset.
>>>>>
>>>>> For e.g.,
>>>>>
>>>>> In the onFetch method of your first dataset that computes the sum,
>>>>> store the sum in a hidden parameter X
>>>>> In the second dataset write your query as select <col names> from
>>>>> <table name> where <col name> = ? Bind the question mark to the
>>>>> parameter X
>>>>>
>>>>> -pc
>>>>>
>>>>> "Jeff" <Jeff@thisplace.com> wrote in message
>>>>> news:f9po1m$uhm$1@build.eclipse.org...
>>>>>> Hello:
>>>>>>
>>>>>> I have a data set which calculates a sum() and returns a single
>>>>>> value. I would like to use this value when selecting data from
>>>>>> "another" data set in a chart. I cannot find a way to get access to
>>>>>> the sum() data set value when I am using another data set in a chart.
>>>>>>
>>>>>> Does anyone have an idea on how to do this?
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Jeff
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Previous Topic:Drop down values are not in ascending order
Next Topic:Birt 2.2 - parameter setting in java event handler
Goto Forum:
  


Current Time: Wed Jul 16 21:05:34 EDT 2025

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

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

Back to the top