【发布时间】:2015-11-18 02:22:27
【问题描述】:
在 ms sql 中有一个 nvarchar 列,根据用户输入,可能有也可能没有回车和换行符 (CHR(13)&CHR(10)),只有回车符 (CHR(13) ),只是一个换行符 (CHR(10))。在 ssrs 中使用该列时,我需要查找是否存在上述任何内容并将它们分别替换为字符串 \x0D\x0A、\x0D 或 \x0A。
我迷失在这个表达中,感谢任何帮助。
=SWITCH
(
(InStr(Fields!Info.Value, CHR(13)&CHR(10) > 0, REPLACE(Fields!Info.Value, CHR(13)&CHR(10)), "\x0D\x0A")),
(InStr(Fields!Info.Value, CHR(13) > 0, REPLACE(Fields!Info.Value, CHR(13)), "\x0D")),
(InStr(Fields!Info.Value, CHR(10) > 0, REPLACE(Fields!Info.Value, CHR(10)), "\x0A"))
)
错误是:
System.Web.Services.Protocols.SoapException:值表达式 textrun ‘Info.Paragraphs[0].TextRuns[0]’ 包含错误: [BC30455] 未为参数“替换”指定参数 '公共函数替换(表达式为字符串,查找为字符串, 替换为字符串,[Start As Integer = 1],[Count As Integer = -1],[比较为 Microsoft.VisualBasic.CompareMethod = Microsoft.VisualBasic.CompareMethod.Binary]) 作为字符串'。在 Microsoft.ReportingServices.Library.ReportingService2005Impl.SetReportDefinition(字符串 Report, Byte[] Definition, Guid batchId, Warning[]&Warnings) at Microsoft.ReportingServices.Library.ReportingService2010Impl.SetItemDefinition(字符串 ItemPath, Byte[] 定义, String expectedItemTypeName, Property[] 属性,警告 [] 和警告)在 Microsoft.ReportingServices.WebServer.ReportingService2010.SetItemDefinition(字符串 ItemPath、Byte[] 定义、Property[] 属性、Warning[]& 警告)
【问题讨论】:
-
replace(replace(Fields!Info.Value,CHR(13),"\x0D"),CHR(10),"\x0A")?
标签: reporting-services replace switch-statement iif ssrs-expression