Skip to main content



      Home
Home » Archived » BIRT » Dynamic where clause in report?(Dynamic where clause in report?)
Dynamic where clause in report? [message #631306] Wed, 06 October 2010 18:38 Go to next message
Eclipse UserFriend
Hi,

Based on the user's inputs, the where clause may contain one or two conditions. Is it possible to have a dynamic where clause in the report's query?

For example, if customer name exists, the where clause will become
select * from customers
where customer_name = ?

if both customer name and phone number exist, the where clause will become

select * from customers
where customer_name = ? and customer_phone_number = ?

Thanks,
kenny
Re: Dynamic where clause in report? [message #631419 is a reply to message #631306] Thu, 07 October 2010 09:55 Go to previous messageGo to next message
Eclipse UserFriend
Depending on your back-end database, I'd do something like the following:

where customer_name = ?
and
(customer_phone_number IS NULL or customer_phone_number = ?)

Some databases don't short-cut evaluation and that last clause may have to be written differently.
Re: Dynamic where clause in report? [message #631546 is a reply to message #631419] Thu, 07 October 2010 18:12 Go to previous messageGo to next message
Eclipse UserFriend
Hi Rich,

Thanks for your reply. But, I'm looking for a way to dynamically add additional condition(s) to the where clause in the same report instead of depending on the DB engine.

do you know whether it's possible?

thanks,
kenny
Re: Dynamic where clause in report? [message #631562 is a reply to message #631306] Thu, 07 October 2010 21:22 Go to previous message
Eclipse UserFriend
You can do pretty much whatever you want to the query text (not just the where clause) by clicking on the data set, going to the Script tab and going into the beforeOpen event. There should be a lot of examples of that in the BIRT communities, I'd search for beforeOpen or queryText.
Previous Topic:Newbie Test
Next Topic:Using RE API without birt installed on the server machine
Goto Forum:
  


Current Time: Wed Jul 23 20:11:09 EDT 2025

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

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

Back to the top