gpt4 book ai didi

reporting-services - 如何在 SSRS 的文本框中显示多值参数选择的子集

转载 作者:行者123 更新时间:2023-12-04 23:55:41 27 4
gpt4 key购买 nike

我在报告中有一个名为 Faculty 的多值参数。我想在报告顶部的文本框中显示选择。显而易见的解决方案是:

JOIN(Parameters!Faculty.Label,", ")

我遇到的问题是列表中的第一个选项(默认)是“All Faculty”。这与 SSRS 提供的“全选”复选框不同。我们创建了这个硬编码的“All”选项,因为它在参数屏幕上看起来更清晰(用户看到“All Faculty”而不是“Adam、Arbor、Altman...”等)。如果用户保持选中状态并进行任何其他选择,我们假设他们只打算选择其他项目,并且存储过程会忽略“全部”选择​​。

所以我想显示这样的东西:

IIF(Parameters!Faculty.Value(0) = "0000000", [*display all selections except value 0*], (JOIN(Parameters!Faculty.Label,", "))

方括号中的部分是我遇到的问题。 0000000 值表示“所有教员”。

最佳答案

OP 在对原始问题的评论中回答:

I ended up using substring. In case anyone else reading this needs the final code, here it is:

IIF(Parameters!Faculty.Count < 6,
IIF(Parameters!Faculty.Value(0) = "0000000",
IIF(Parameters!Faculty.Count = 1, (JOIN(Parameters!Faculty.Label,";
")), (JOIN(Parameters!Faculty.Label,"; ").Substring(13))),
(JOIN(Parameters!Faculty.Label,"; "))), "Multiple")

I added a check so that it will only display up to 5 at a time, otherwise it says "Multiple". I did Substring(13) because "All Faculty; " is 13 characters including spaces.

The solution above worked initially, but failed when the string was less than 14 characters (due to the IIF). You set me on the right track and I came up with a fairly elegant solution:

Switch(Parameters!Faculty.Count > 5, "Multiple Selected",
Parameters!Faculty.Count <= 5,
Replace((JOIN(Parameters!Faculty.Label,"; ")),"All Faculty; ",
""))'code'

关于reporting-services - 如何在 SSRS 的文本框中显示多值参数选择的子集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11942835/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com