2016-04-15 89 views
1

我想知道是否有人可以幫助我們理解爲什麼SSRS在我的Textbox13文本框中返回Error。SSRS VB IIF語句返回NULL值的錯誤

Warning 1 [rsRuntimeErrorInExpression] The Value expression for the textrun ‘Textbox13.Paragraphs[0].TextRuns[0]’ contains an error: Conversion from string "NULL" to type 'Date' is not valid.

值Workorder_Closed_Date是SQL查詢的結果,並且無論是填充或NULL

=IIF(IsNothing(Fields!Workorder_Closed_Date.Value), 
    reportitems!Textbox13.Value="open", 
    reportitems!Textbox13.Value="closed") 
+0

「Textbox13」的表達式是? –

回答

3

如果表達式爲Textbox13,那麼這會工作:

=IIf(IsNothing(Fields!WorkOrder_Closed_Date.Value), "open", "closed") 

請注意IIf同時執行truefalse部分,所以你想在的恆定表達式的條件的每一個分支,而不是副作用。

=IIf(condition, value_if_true, value_if_false) 

天啊。

Warning 1 [rsRuntimeErrorInExpression] The Value expression for the textrun ‘Textbox13.Paragraphs[0].TextRuns[0]’ contains an error: Conversion from string "NULL" to type 'Date' is not valid

你的價值不是null(或Nothing實際上) - 這是一個字符串文字包含值"NULL"

您需要修正您的數據,而不是您的報告。

+0

嘗試過,但看起來像SSRS拒絕領域!WorkOrder_Closed_Date.Value –

+1

我沒有注意到這一點,但我得到以下錯誤警告 [rsRuntimeErrorInExpression] textrun的值表達式'Textbox13.Paragraphs [0] .TextRuns [0]'包含錯誤:從字符串「NULL」到類型「Date」的轉換無效。 –

+0

@SteveHobbs編輯。 –