BIRT-Report parameter default value as null [message #87418] |
Fri, 04 November 2005 03:58  |
Eclipse User |
|
|
|
Originally posted by: arun_18k.yahoo.com
Hi,
I found BIRT while searching for a reporting tool. Since then
I have been exploring the features of BIRT. It is very interesting and
excellent indeed. I have tried creating test reports using the report
designer connecting to my database. Also i have tried by binding the
report parametres and dataset parameters and using it.
I have a specific requirement here.
The BIRT enforces that the parameter passed to a query must have a default
value. In my case,
the query normally has 4 to 5 attributes for the search criteria and they
would be optional.
In the normal programming, I write the query in SQL Server 2000 as below.
SELECT * FROM CUSTOMER
WHERE (? IS NULL OR CUSTOMER.CUST_CODE = ?) OR (? IS NULL OR
CUSTOMER.CUST_CITY = ?)
In the above query, the 1st and 2nd parameters are related to the customer
code and the 3rd and 4th are related to the city. If the city is passed as
null, for example, it would fetch the records of customers of all cities.
Since BIRT enforces default values for the NULL attributes, the above
logic does not work. I may have to write one report for each possible
combination of parameters, but that may not be a right thing to do.Any
help to achieve optional parameters or how to set null values for the
parameter is highly appreciated.
Thanks & Regards
Arun
|
|
|
Re: BIRT-Report parameter default value as null [message #87691 is a reply to message #87418] |
Fri, 04 November 2005 11:25  |
Eclipse User |
|
|
|
Arun,
Have you tried something like
SELECT * FROM CUSTOMER
WHERE (CUSTOMER.CUST_CODE LIKE ?) OR
(CUSTOMER.CUST_CITY LIKE ?)
Then set the default value to '%'
There may be a better way to do this, and I know this doesnt do exactly what
your query does.
Jason Weathersby
BIRT PMC
"Arun" <arun_18k@yahoo.com> wrote in message
news:9fe0631dcac8d413646ebe8d034abf21$1@www.eclipse.org...
> Hi,
> I found BIRT while searching for a reporting tool. Since then I
> have been exploring the features of BIRT. It is very interesting and
> excellent indeed. I have tried creating test reports using the report
> designer connecting to my database. Also i have tried by binding the
> report parametres and dataset parameters and using it. I have a specific
> requirement here.
> The BIRT enforces that the parameter passed to a query must have a default
> value. In my case, the query normally has 4 to 5 attributes for the search
> criteria and they would be optional. In the normal programming, I write
> the query in SQL Server 2000 as below.
> SELECT * FROM CUSTOMER
> WHERE (? IS NULL OR CUSTOMER.CUST_CODE = ?) OR (? IS NULL OR
> CUSTOMER.CUST_CITY = ?)
> In the above query, the 1st and 2nd parameters are related to the customer
> code and the 3rd and 4th are related to the city. If the city is passed as
> null, for example, it would fetch the records of customers of all cities.
> Since BIRT enforces default values for the NULL attributes, the above
> logic does not work. I may have to write one report for each possible
> combination of parameters, but that may not be a right thing to do.Any
> help to achieve optional parameters or how to set null values for the
> parameter is highly appreciated.
>
> Thanks & Regards
> Arun
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03875 seconds