Make a dependent input display NO options, when no options are selected from the parent input

I have two inputs. "Sites" & "Controllers". Controllers are the children of Sites. 

"Controllers" Custom Input Query

SELECT id, name FROM controllers WHERE $X{IN, site_id, site_id_1}

When site_id_1 has nothing selected

I expect: the return set to be empty
I get: all the controllers in the DB

Question: How do I make the query return no results when site_id_1 has no options selected?

What I've tried:

SELECT id, name FROM controllers WHERE (CASE WHEN ($P{site_id_1} = NULL) THEN id = 0 ELSE $X{IN, site_id, site_id_1} END)

However I don't know the data type of $P{site_id_1}, thus I don't know how to write an expression to test if the parameter is empty.

Thanks in Advance!

andey.wei's picture
Joined: Feb 19 2014 - 1:45pm
Last seen: 8 years 7 months ago

1 Answer:

Why don't you just check the input parameter? Do something like in the following thread but replace MyVerifiedParam default to something that'll return no result.

hozawa's picture
Joined: Apr 24 2010 - 4:31pm
Last seen: 3 years 12 months ago

I would like to check the parameter, but I'm not sure how. I tried "CASE WHEN ($P{site_id_1} = NULL)", but it always will fail that check.

andey.wei - 9 years 2 months ago