Jump to content

How to get entire report by using one parameter in jasper report?

Recommended Posts

my table have columns id , Category , City,Quantity, UnitPrice etc. I want to get my entire report using one parameter $P={City}(SQL dynamic query for jasperreport) like when I will pass ALL value to parameter $P={City} it should have to show my entire report what I was doing previously was tried doing it with another parameter but its wrong i guesss

Select * from sales where City=$P{City} or $P{ALLL} is not null

but then whenever I will pass any value in all it will give entire report which is wrong way 

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

I will tell you that I may not understand your requirements.


In the following SQL case, if a value is entered for the single value parameter 'P_City', the data will be retrieved with the entered condition.
If no value is entered for the single value parameter 'P_City', all data will be retrieved.

Select * from sales where (City=$P{P_City}) or ($P{P_City} is null)[/code]


If 'P_City' is a multi-valued parameter (Class=java.util.Collection) instead of a single-valued parameter (Class=java.lang.String), then the SQL will look like this

Select * from sales where $X{IN, City, P_City}[/code]


I hope this is helpful.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...