简体   繁体   English

SSRS报告中的参数未获取空值显示为空白

[英]Parameter not picking up NULL values in SSRS report appears blank

I need to design report using Date parameters(needs be in UK date format) 我需要使用日期参数来设计报告(需要采用英国日期格式)

Original date format: 2007-11-30 00:00:00.000

So, I am using CONVERT(Date, Start_Date, 103): 2007-11-30 in my query.

Data in Query:

Start_Date            End_Date                Type
---------------------------------------------------------------      NULL                  2016-01-23                 3 Month 
2009-08-11            2009-07-27                 3 Month  
NULL                  2015-10-13                 3 Month
NULL                  2016-02-16                 3 Month
NULL                  2015-12-28                 3 Month

Now while designing report I am using this dataset: 现在,在设计报告时,我正在使用此数据集:

Main dataset Query: 主要数据集查询:

SELECT Col1, Col2, Start_Date, Target_Date, Col3
FROM  Table
WHERE        (Col1 IN (@Param1))
AND (Col2IN (@Param2)) 
AND (Start_Date IN (@Start_Date)) AND (Target_Date IN (@Target_Date))

Now, When I run this report for Start_Date = 2009-08-11  and End_Date = 2009-07-27  and Type= 3 Month I get detailed data in report. 

However, When I select Start_Date = NULL   and End_Date = 2016-02-16   and Type= 3 Month my report appears blank. I checked dataset and that too returns all values as NULL.

Can you please suggest/help with this issue? 您能否建议/帮助解决此问题?

Regards, AR 问候,AR

Start_Date = NULL 

Will not work.You need to use 无法使用。您需要使用

Start_Date IS NULL 

or 要么

ISNULL(Start_Date, 0) = 0

so something like this: 所以像这样:

SELECT Col1, Col2, Start_Date, Target_Date, Col3
FROM [Table]
WHERE Col1 IN (@Param1)
      AND Col2 IN (@Param2)
      AND ISNULL(Start_Date, 0) IN (ISNULL(@Start_Date, 0))
      AND ISNULL(Target_Date, 0) IN (ISNULL(@Target_Date, 0));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM