Jump to content
Changes to the Jaspersoft community edition download ×

How can I get a query to select IDs based on a list input by the user or select all IDs


gradstu1

Recommended Posts

I currently have this

select * from admwhere (adm.id  IN $P!{ID} or $P{ID}='ALL')[/code]

adm.id IN $P!{ID} or $P{ID}='ALL' work great if I delete one of them, but with both I get an error.  I need my report to allow users to enter more than one ID or enter no IDs (defaulting to all) and have them all show up

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

hi gradstu1 !

i think u dont use "OR" in "IN" unless theres subquery inside "IN".
ckeck https://www.w3schools.com/sql/sql_in.asp :D

perhaps u need to write "... WHERE adm.id IN($P{ID}, 'ALL') ...", it will return ID which user input & 'ALL'.
but that will only work for 1 parameter, idk if  case "$P{ID}" contains multiple value separated by comma "," could be read by the query as well.

hth + regards

C-TV
lol

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