Jump to content
Changes to the Jaspersoft community edition download ×

java.util.Collection as parameter for sql function


Recommended Posts

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Check IN and NOTIN Clauses.

JasperReports provides a special syntax to use with a where condition: the IN and NOTIN clauses.The IN clause checks whether a particular value is present in a discrete set of values. Here is an example:SELECT * FROM ORDERS WHERE SHIPCOUNTRY IS IN ('USA','Italy','Germany')The set here is defined by the countries USA, Italy and Germany. Assuming we are passing the set of countries in a list (or better a java.util.Collection) or in an array, the syntax to make the previous query dynamic in reference to the set of countries is:SELECT * FROM ORDERS WHERE $X{IN, SHIPCOUNTRY, myCountries}where myCountries is the name of the parameter that contains the set of country names. The $X{} clause recognizes three parameters:[/code]


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...