tejaswini.patil2000 Posted July 14, 2021 Share Posted July 14, 2021 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 guesssSelect * from sales where City=$P{City} or $P{ALLL} is not nullbut 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 More sharing options...
yama818 Posted July 14, 2021 Share Posted July 14, 2021 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 thisSelect * from sales where $X{IN, City, P_City}[/code] I hope this is helpful. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now