报表设计器选择适当的值

发布于 2024-09-06 11:16:38 字数 810 浏览 1 评论 0原文

我正在使用 Visual Studio 创建报告。我在将适当的值输入文本字段时遇到问题。

我有一个包含以下值的数据集:
InfoPathForms工作流程
平均处理时间_总和
AvgProcessTime_Count

此数据集中仅包含 1 或 2 个值。它由 InfoPath 表单填充(数据集中的值都是准确且有效的)。

InfoPathFormsWorkflow 可以是“关闭”或“打开”。我目前有 2 个带有这些表达式的文本字段:

=IIF(Fields!InfoPathFormsWorkflow.Value = "Closed",Fields!AvgProcessTime_Sum.Value / Fields!AvgProcessTime_Count.Value,"No Value")

=IIF(Fields!InfoPathFormsWorkflow.Value = "Open",Fields!AvgProcessTime_Sum.Value / Fields!AvgProcessTime_Count.Value,"No Value")

当数据集只有 1 个值(“打开”或“关闭”)时,该文本字段将正确显示,但当数据集有 2 个值(“关闭”和“打开”时) ”条目),那么只有第一个条目会正确显示,第二个条目将显示“无值”。因此,如果第一行有 InfoPathFormsWorkflow.value =“Close”,那么它将起作用,但“Open”则不起作用。或者反之亦然。

选择正确的行条目有什么技巧吗?我读过一些有关使用参数的内容,但我似乎无法理解它是如何工作的。任何帮助都会很棒!这是另一名工人花了 80 个小时才交给我的。

I am using Visual Studio to create a Report. I am having a problem getting the appropriate value into a text field.

I have a DataSet with these values:
InfoPathFormsWorkflow
AvgProcessTime_Sum
AvgProcessTime_Count

This DataSet will only have 1 or 2 values in it. It is being populated by an InfoPath form (the values in the DataSet are all accurate and working).

InfoPathFormsWorkflow is either "Close" or "Open". I currently have 2 text fields with these expressions:

=IIF(Fields!InfoPathFormsWorkflow.Value = "Closed",Fields!AvgProcessTime_Sum.Value / Fields!AvgProcessTime_Count.Value,"No Value")

=IIF(Fields!InfoPathFormsWorkflow.Value = "Open",Fields!AvgProcessTime_Sum.Value / Fields!AvgProcessTime_Count.Value,"No Value")

When the DataSet only has 1 value (either with "Open" or "Close") that text field will display correctly, but when the DataSet has 2 values (both "Close" and "Open" entries) then only the fist one will display correctly and the second one will display "No Value". So if the first row has InfoPathFormsWorkflow.value = "Close" then it will work but the "Open" will not. Or visa versa.

Is there a trick to selecting the right row entry? I have read a bit about using Parameters, but I cant seem to understand how that works. Any help would be great! This got handed to me after another worker here spend 80 hours on it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

独﹏钓一江月 2024-09-13 11:16:38

这些是 Tablix 内部还是外部的文本字段?

如果他们在外面,我认为情况似乎如此(尽管我觉得这个表达根本不应该起作用,所以也许我错了......),这会有点笨拙,但仍然是完全可能(假设您只有这两行):

对于封闭的文本字段:

=IIF(First(Fields!InfoPathFormsWorkflow.Value, "YourDataSetName") = "Closed", 
     First(Fields!AvgProcessTime_Sum.Value, "YourDataSetName") / 
       First(Fields!AvgProcessTime_Count.Value, "YourDataSetName"),
     IIF(Last(Fields!InfoPathFormsWorkflow.Value, "YourDataSetName") = "Closed",
         Last(Fields!AvgProcessTime_Sum.Value, "YourDataSetName") /
           Last(Fields!AvgProcessTime_Count.Value, "YourDataSetName")
         "No Value"
     )
)

对于开放的文本字段同样如此:

=IIF(First(Fields!InfoPathFormsWorkflow.Value, "YourDataSetName") = "Open", 
     First(Fields!AvgProcessTime_Sum.Value, "YourDataSetName") / 
       First(Fields!AvgProcessTime_Count.Value, "YourDataSetName"),
     IIF(Last(Fields!InfoPathFormsWorkflow.Value, "YourDataSetName") = "Open",
         Last(Fields!AvgProcessTime_Sum.Value, "YourDataSetName") /
           Last(Fields!AvgProcessTime_Count.Value, "YourDataSetName")
         "No Value"
     )
)

如果您想要不同的东西,请告诉我。 Report Services 有时有点固执地想让事情变得简单,但大多数事情最终都可以通过正确的(冗长的)表达式来按预期运行。

These are TextFields inside or outside your Tablix?

If they're outside, which I think seems to be the case (although I feel like that expression shouldn't be working at all then, so maybe I'm wrong...), this gets a little unwieldy, but is still entirely possible (assuming you only have those two rows):

For the Closed TextField:

=IIF(First(Fields!InfoPathFormsWorkflow.Value, "YourDataSetName") = "Closed", 
     First(Fields!AvgProcessTime_Sum.Value, "YourDataSetName") / 
       First(Fields!AvgProcessTime_Count.Value, "YourDataSetName"),
     IIF(Last(Fields!InfoPathFormsWorkflow.Value, "YourDataSetName") = "Closed",
         Last(Fields!AvgProcessTime_Sum.Value, "YourDataSetName") /
           Last(Fields!AvgProcessTime_Count.Value, "YourDataSetName")
         "No Value"
     )
)

Likewise for the Open TextField:

=IIF(First(Fields!InfoPathFormsWorkflow.Value, "YourDataSetName") = "Open", 
     First(Fields!AvgProcessTime_Sum.Value, "YourDataSetName") / 
       First(Fields!AvgProcessTime_Count.Value, "YourDataSetName"),
     IIF(Last(Fields!InfoPathFormsWorkflow.Value, "YourDataSetName") = "Open",
         Last(Fields!AvgProcessTime_Sum.Value, "YourDataSetName") /
           Last(Fields!AvgProcessTime_Count.Value, "YourDataSetName")
         "No Value"
     )
)

If you wanted something different, let me know. Report Services is a bit stubborn about making things easy sometimes, but most things can eventually be made to behave as anticipated with the right (lengthy) expression.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文