reporting-services - 调试 SSRS 的最佳策略是什么?

标签 reporting-services bug-tracking

我正在寻找追踪 SSRS 错误发生位置的方法。

我有一份包含多个公式的约 90 列宽的报告。我遇到的问题是,其中一个公式存在除以零的错误。我已经在这个 question 中实现了 Robert Harvey 的回答。但我仍然得到错误。我知道答案是有效的,因为我已经在一份小报告上对其进行了测试。

所以问题是:当 SSRS 仅报告发生错误时,您究竟如何识别 SSRS 中发生错误的位置?

编辑 显示的错误是

An error occured during local report processing
An error has occoured during report processing
Cannot read next data row for the dataset MainReport
Divide By Zero error encounted

最佳答案

编辑
而不是使用 IIF 语句和其他语句,我建议执行以下操作...向您的报告添加自定义函数,转到报告属性和代码选项卡。创建以下内容。要具体识别引发错误的字段,您可以将其更改为返回一个字符串,也许还有“#OOOOOOPS”,这样它就会突出显示在报告中。

Public Function SafeDivision(ByVal top As Decimal, ByVal bottom As Decimal) As Decimal
   If bottom = 0 Then
      Return 0
      Else : Return top / bottom
   End If
End Function

添加此函数后,转到表达式 View ,查看所有将发生除法的字段。您可以通过键入以下内容来执行这个新创建的函数:

=Code.SafeDivivision(CDbl(1.24), CDbl(0))

原创
如果您在 visual studio 中运行报告,它会告诉您计算失败的特定文本框/标签/字段吗?这应该有助于查明问题的来源,但您也可以通过查看下面的代码来确保您永远不会执行分母为 0 的除法...

//myBottom would be the value of the denominator 
//myTop would be the value of the numerator 

= IIF(myBottom <> 0, myTop / myBottom, "")

关于reporting-services - 调试 SSRS 的最佳策略是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1225111/

相关文章:

release-management - 从 Trac 自动生成发行说明

.net - 我一直听说有大量的错误跟踪器,但 .net 中构建的却不多

reporting-services - 在报告执行前添加报告描述文本框

oracle - VS2008 SSRS 用于查询 Oracle : How do I stop {oj} for outer Joins?

sql-server - SQL Reporting Services 05 - 表头上的自定义代码总和显示

c# - SQL 报告服务 : Finding the folder a report is in

svn - 如何确保 Subversion 中版本分支中的错误修复合并到主干中

bug-tracking - 一个人的错误追踪者?

agile - 我可以在 YouTrack AgileBoard 中为卡片着色吗?

reporting-services - 尝试从 Business Intelligence Studio 预览报表时出现错误 "Data retrieval failed for the subreport, ' 子报表 1'"