This is a migrated thread and some comments may be shown as answers.

How do I work with null values when I'm trying to query a collection subset

3 Answers 416 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
Ben
Top achievements
Rank 1
Ben asked on 18 Sep 2014, 04:01 AM
I'm using a multivalue parameter and its currently giving me a little grief for a single case. Null

my query is:

select * from table where column1 in (?)

which ends up looking like
select * from table where column1 in ('a','b','c')

this is a problem with null included because it evaluates to unknown and can't continue.

with the following query this works but I'm not sure of how to set up the parameters to make this work.


select * from table where column1 in ('a','b','c') or tag is null

Can you help me understand how I can set up or format my multivalue parameter to deal with this?

3 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 22 Sep 2014, 12:46 PM
Hello Ben,

Please check the following forum discussion and the used solutions for cases when you need to check for Null: Multivalue parameter with AllowNull = true is not working.


I hope the above information is helpful.

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Ben
Top achievements
Rank 1
answered on 26 Sep 2014, 05:15 AM
the option for coalesce doesn't seem to be quite what I'm looking for. with coalesce it takes the first non null parameter so if I only want to look at the null situation thats fine but if I want to look at the situation where its null and 2 or 3 other values this doesn't work.

Any other thoughts?
0
Ben
Top achievements
Rank 1
answered on 30 Sep 2014, 06:16 AM
I was able to solve this by wrapping the null condition up in a sub query

select * from (
select isnull(column,'some_value') from table
) where column in (@columnValues)

this gives the column a value even when null. then I just have the same isnull check on my query that allows me to pick my columns from the multivalue report parameter
Tags
Report Designer (standalone)
Asked by
Ben
Top achievements
Rank 1
Answers by
Stef
Telerik team
Ben
Top achievements
Rank 1
Share this question
or