Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Custom SQL as a parameter(User can write custom sql where condition in parameter)
Custom SQL as a parameter [message #1007138] Mon, 04 February 2013 15:26 Go to next message
Tomas Greif is currently offline Tomas GreifFriend
Messages: 53
Registered: September 2010
Member
Hi,

I would like to create a parameter linked to dataset parameters. This parameter should be used in WHERE clause of SQL statement. In other words I would like to create the following (example) dataset:

select * from table where ?


Where ? is dataset parameter linked to report parameter where default value for report parameter is 1=1

If I use such approach then ? in SQL is replaced correctly (I guess) by parameter value (I have set default value for parameter). However the error I get back is:

Failed to prepare the query execution for the data set: VintageData
Cannot get the result set metadata.
    org.eclipse.birt.report.data.oda.jdbc.JDBCException: SQL statement does not return a ResultSet object.
SQL error #1: ERROR: argument of WHERE must be type boolean, not type character varying


Is there a way how can I make this work?

We are using BIRT 2.6.1 and PostgreSQL 9.1
Re: Custom SQL as a parameter [message #1007215 is a reply to message #1007138] Tue, 05 February 2013 04:41 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

You could instead use a query like, "select * from table". Then, in your beforeOpen script of your dataSet, you'd put something like:

this.queryText = this.queryText + " where " + params["whereParam"];

You'll need to make sure that the sql in the parameter is formatted correctly, somehow, or it will break.


Michael

Developer Evangelist, Silanis
Re: Custom SQL as a parameter [message #1007242 is a reply to message #1007215] Tue, 05 February 2013 08:27 Go to previous messageGo to next message
Tomas Greif is currently offline Tomas GreifFriend
Messages: 53
Registered: September 2010
Member
Hi Michael,

this works perfect!

Thank you.

Regards,

Tomas
Re: Custom SQL as a parameter [message #1007337 is a reply to message #1007242] Tue, 05 February 2013 15:05 Go to previous message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

You're welcome!

Michael

Developer Evangelist, Silanis
Previous Topic:Gantt chart multiple timeframes per series
Next Topic:library to display graphs
Goto Forum:
  


Current Time: Thu Apr 25 00:20:29 GMT 2024

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

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

Back to the top