繁体   English   中英

SSRS报告-套管参数

[英]SSRS report - Casing parameter

我在“报告”构建器3中的SSRS报告中遇到问题。我正在尝试使用大小写用于显示文本而不是字段的int数据类型的参数。 每次我尝试预览报告时,Report Builder都会吐出一个错误。 我尝试过转换和转换数据类型,但仍然遇到相同的错误。 任何见解将不胜感激。 下面是参数正在查询的查询和错误消息。

-查询

select distinct case convert(varchar(10),workorderstatusid)
when '1' then 'Open'
when '2' then 'Closed'
when '105' then 'OnHold'
when '101' then 'Cancelled'
end  as 'Status'
from tasks

- 错误信息

Cannot read the next data row for the dataset DataSet1. (rsErrorReadingNextDataRow)
----------------------------
An error has occurred during report processing. (rsProcessingAborted)

-数据集1-主要查询

select wo_num as 'Word Order ID',isnull(dept,'Unassigned') as 'Department', 
task as 'Summary', isnull(descript, 'No Description') as 'Notes', 
respons as 'Assigned Technician', duedate as 'Due Date',completed as 'Date Completed',
isnull(status,'Incomplete') as 'Status'
from tasks
where (workorderstatusid =@status)
and (dept=@department)
order by wo_num asc

首先添加参数并将其“类型”设置为“文本”,并检查多个值,如下所示

在此处输入图片说明

然后设置默认值以通过查询设置并选择数据集

在此处输入图片说明

弄清楚了,需要在主查询之前包含此语句

if (@status = 'Open')
begin 
      set @status = 1
end
else if (@status = 'Closed')
Begin
      set @status = 2
End
else if (@status = 'OnHold')
Begin
      set @status = 105
End
else if (@status = 'Cancelled')
Begin
      set @status = 101
End

暂无
暂无

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

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