簡體   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