Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » How to use URL parameters in SQL query?
How to use URL parameters in SQL query? [message #132037] Fri, 17 February 2006 08:21 Go to next message
mr. burns is currently offline mr. burnsFriend
Messages: 402
Registered: July 2009
Senior Member
Hello,

I don't know where to start.
I have a report I which want to start with an URL parameter like follows:

e.g.: /birt-viewer/run?format=html&__report=myreport.rptdesign &myparam=1

Now I want to evaluate the parameter myparam in my reports database query
like follows:

select * from mytable where myfield = myparam;
where myparam comes from the URL.

So the query should result in: select * from mytable where myfield = 1;

Can anyone lead me into the right direction how to achieve this?

Thanks a lot!
Re: How to use URL parameters in SQL query? [message #132364 is a reply to message #132037] Fri, 17 February 2006 16:19 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

First create the dataset with a query and dataset parameter.

select * from mytable where myfield = ?

Select the dataset parameter and verify the type.

Add a report parameter that matches the dataset parameter.

use your dataset on a table or list.

Select the binding tab on the table or list.
Your dataset parameter will show up in the list with the default value you
used in the query.
Change the value (Still on the binding tab) to params["parametername"] (this
is the report parameter).

Jason

"Mr. Burns" <Mr._Burns@web.de> wrote in message
news:dt412v$4gu$1@utils.eclipse.org...
> Hello,
>
> I don't know where to start.
> I have a report I which want to start with an URL parameter like follows:
>
> e.g.: /birt-viewer/run?format=html&__report=myreport.rptdesign &myparam=1
>
> Now I want to evaluate the parameter myparam in my reports database query
> like follows:
>
> select * from mytable where myfield = myparam;
> where myparam comes from the URL.
>
> So the query should result in: select * from mytable where myfield = 1;
>
> Can anyone lead me into the right direction how to achieve this?
>
> Thanks a lot!
>
Re: How to use URL parameters in SQL query? [message #132662 is a reply to message #132364] Mon, 20 February 2006 09:25 Go to previous messageGo to next message
mr. burns is currently offline mr. burnsFriend
Messages: 402
Registered: July 2009
Senior Member
Hello Jason,

thanks for your reply, but in my report I just have a single chart, no
table, no list!
So for a chart I cannot select the binding tab :-(

Should I use a table and make it unvisible, or will there be a binding tab
also for charts?
Any furter ideas?

Thanks for further help!
Re: How to use URL parameters in SQL query? [message #132687 is a reply to message #132364] Mon, 20 February 2006 10:17 Go to previous messageGo to next message
mr. burns is currently offline mr. burnsFriend
Messages: 402
Registered: July 2009
Senior Member
Hello,

....or can I modify the SQL query using scripting?

Something like:

queryText = "select * from MyTable where MyField = " + myparam;

How it is correct? Where I must place such code?

Thanks for any help!
Re: How to use URL parameters in SQL query? [message #132933 is a reply to message #132687] Mon, 20 February 2006 17:22 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

There is a parameters button on the Select Data of the graph that you can
put the
params["ParameterName"] in. This will give an error at design time, but
will work when you run it.

Jason

"Mr. Burns" <Mr._Burns@web.de> wrote in message
news:dtc4vj$dn8$1@utils.eclipse.org...
> Hello,
>
> ...or can I modify the SQL query using scripting?
>
> Something like:
>
> queryText = "select * from MyTable where MyField = " + myparam;
>
> How it is correct? Where I must place such code?
>
> Thanks for any help!
>
>
>
Re: How to use URL parameters in SQL query? [message #133168 is a reply to message #132933] Tue, 21 February 2006 07:43 Go to previous messageGo to next message
mr. burns is currently offline mr. burnsFriend
Messages: 402
Registered: July 2009
Senior Member
Hello Jason,

thanks fo your reply! I found the parameters button you mentioned but don't
know how to use.
I can create a dataset parameter, and select it by the parameters button you
mentioned but don't know how to bind it to the report parameter, remember I
just have a chart so no list or table where I can choose the binding tab.
What about my idea to choose scripting like under a previous version of BIRT
(before 2.0.0) ther was a possibility to use:

queryText = "select * from myTable where myField = " + params["myParam"];

Or is the dataset binding the right way to go with?

Any further help?

PS:
BIRT 2.0.0 is really a fine thing, but if the documentation is behind the
release than the users of BIRT don't know how to use the new features and
then they get unsatisfied because everyting one wants to achieve is to do by
try and error, and this is really timeconsuming, unprofessional and of less
success.
And posting every problem here into the newsgroups cannot be the solution,
or waht do you think?
So WHEN please the documentation gets updated as well?
See also my post: ROM_Scripting_SPEC.pdf still from May 2005 (from
2005-02-20) or pass it to the related BIRT team member please.
Re: How to use URL parameters in SQL query? [message #133641 is a reply to message #133168] Tue, 21 February 2006 16:26 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

You can do it the old way. I dont know that either is better.
If you want to use the parameters on the chart:

Choose the select data button
click the radial to Use Data Set (Choose your dataset)
select the parameters button (your data set parameter should show up there)
click on the value and enter params["ParameterName"]
This procedure effectively does the bind.
You will get an error at design time, but it should work at runtime.

Jason



"Mr. Burns" <Mr._Burns@web.de> wrote in message
news:dtegas$d1$1@utils.eclipse.org...
> Hello Jason,
>
> thanks fo your reply! I found the parameters button you mentioned but
> don't know how to use.
> I can create a dataset parameter, and select it by the parameters button
> you mentioned but don't know how to bind it to the report parameter,
> remember I just have a chart so no list or table where I can choose the
> binding tab.
> What about my idea to choose scripting like under a previous version of
> BIRT (before 2.0.0) ther was a possibility to use:
>
> queryText = "select * from myTable where myField = " + params["myParam"];
>
> Or is the dataset binding the right way to go with?
>
> Any further help?
>
> PS:
> BIRT 2.0.0 is really a fine thing, but if the documentation is behind the
> release than the users of BIRT don't know how to use the new features and
> then they get unsatisfied because everyting one wants to achieve is to do
> by try and error, and this is really timeconsuming, unprofessional and of
> less success.
> And posting every problem here into the newsgroups cannot be the solution,
> or waht do you think?
> So WHEN please the documentation gets updated as well?
> See also my post: ROM_Scripting_SPEC.pdf still from May 2005 (from
> 2005-02-20) or pass it to the related BIRT team member please.
>
Re: How to use URL parameters in SQL query? [message #1809129 is a reply to message #133641] Tue, 09 July 2019 15:24 Go to previous message
Anderson  Aguiar is currently offline Anderson AguiarFriend
Messages: 1
Registered: July 2019
Junior Member

How can I generate the URL of my BIRT report in order to run it from postgress?

thank you for your attention I hope you can help me
Previous Topic:Set Aggregation value to a Global Variable
Next Topic:Reduce BIRT PDF report size (with images)
Goto Forum:
  


Current Time: Fri Dec 27 04:52:59 GMT 2024

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

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

Back to the top