简体   繁体   English

SSRS 2008 R2:在需要条件的上下文中在“,”附近指定非布尔类型的表达式

[英]SSRS 2008 R2: An expression of non-boolean type specified in a context where a condition is expected, near ','

In my SSRS 2008 R2 report I have a multi-value @Status parameter. 在我的SSRS 2008 R2报告中,我有一个多值@Status参数。 This is the dataset: 这是数据集:

SELECT 1 AS ID, Description
FROM [ApplicationStatus]
WHERE StatusID IN (5, 6, 11, 14)
UNION
SELECT 2 AS ID, Description
FROM [ApplicationStatus]
WHERE StatusID IN (10)

In my main ReportData dataset I have the following filter: 在我的主要ReportData数据集中,我具有以下过滤器:

WHERE ((@Status IN (1) AND a.StatusID IN (5, 6, 11, 14)) 
OR (@Status IN (2) AND a.StatusID IN (10)))

The report runs fine when selecting either 1 and 2 as the value in the @Status drop-down, but when I select the built-in '(Select All)' option, I get the following error message: 在@Status下拉列表中选择1和2作为值时,报表运行良好,但是当我选择内置的“(Select All)”选项时,出现以下错误消息:

Query execution failed for dataset 'ReportData'. 数据集“ ReportData”的查询执行失败。 An expression of non-boolean type specified in a context where a condition is expected, near ','. 在需要条件的上下文中在“,”附近指定的非布尔类型的表达式。

The multiple values are in @Status, therefore @status needs to be after IN, not before. 多个值位于@Status中,因此@status必须在IN之后,而不是之前。

WHERE (( 1 IN (@Status)  AND a.StatusID IN (5, 6, 11, 14)) 
OR (2 In (@Status) AND a.StatusID IN (10)))

暂无
暂无

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

相关问题 SSRS 数据集 - 在预期条件的上下文中指定的非布尔类型的表达式,靠近“,” - SSRS Dataset - An expression of non-boolean type specified in a context where a condition is expected, near ',' where子句引起错误的情况:在需要条件的上下文中,在')'附近指定非布尔类型的表达式 - case in where clause causes the error : An expression of non-boolean type specified in a context where a condition is expected, near ')' 在预期条件的上下文中指定的非布尔类型的表达式,靠近 WHERE - An expression of non-boolean type specified in a context where a condition is expected, near WHERE 在需要条件的上下文中在“和”附近指定的非布尔类型的表达式。 C# - An expression of non-boolean type specified in a context where a condition is expected, near 'and'. C# 在需要条件的上下文中在“,”附近指定的非布尔类型的表达式 - An expression of non-boolean type specified in a context where a condition is expected, near ',' 在“ AdmissionID”附近需要预期条件的上下文中指定的非布尔类型的表达式 - An expression of non-boolean type specified in a context where a condition is expected, near 'AdmissionID' 在预期条件的上下文中指定的非布尔类型的表达式,靠近“GROUP” - An expression of non-boolean type specified in a context where a condition is expected, near 'GROUP' 在期望条件的上下文中指定的非布尔类型的表达式,在')'附近 - An expression of non-boolean type specified in a context where a condition is expected, near ')' 在期望条件的上下文中指定的非布尔类型的表达式,在IDT中接近“)”错误 - An expression of non-boolean type specified in a context where a condition is expected, near ')' error in IDT 在期望“ END”附近存在条件的上下文中指定的非布尔类型的表达式 - An expression of non-boolean type specified in a context where a condition is expected near 'END'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM