如何使用 Business Objects SDK 将空值传递给 Business Objects 报表中的可选参数?
我正在构建一个 Web 前端,用于使用 Business Objects SDK for .NET 访问 Business Objects 报告。通过网上有关该主题的稀疏文档和论坛帖子,我已经能够满足 95% 的业务需求。我的最后一个障碍集中在使用参数化报告。我们的业务存在这样的情况:报表有两个参数,而最终用户只需要填充其中之一。收集和清理这些数据很容易,但无论我如何尝试将空值参数传递给报告,我都没有得到任何数据。如果两个参数都已填充,我确实会得到预期的数据。在 Visual Studio 中单步执行代码时,我发现只要 BusinessObjects 返回空值参数,它就会显示为空字符串 ("")。我尝试将其作为参数值传递,并尝试为该参数分配 null 值。一旦计划并运行报告,这些选项都不会返回结果。下面是我使用我所采用的每种方法的参数分配代码的示例(我们需要检查值为“null”的字符串,因为用户请求能够键入“null”并将其传递给报告)。这些都不会生成包含数据的报告。
sVal.Value = param.ParameterValue != "null" ? param.ParameterValue : String.Empty;
sVal.Value = param.ParameterValue != "null" ? param.ParameterValue : "";
sVal.Value = param.ParameterValue != "null" ? param.ParameterValue : null;
Enterprise Server 是否有一个特定值用于指示 null,例如需要将日期包装在 Date() 中?
编辑:我需要复制的功能如 InfoView 中所示:
I am building a web front end for accessing Business Objects reports using the Business Objects SDK for .NET. I have been able to hack my way through 95% of the business requirements with the sparse documentation and forum posts available online for the topic. My final roadblock centers on working with parameterized reports. Our business has situations in which a report has two parameters and the end user is only requried to populate one of them. It's easy enough to collect and cleanse this data, but no matter how I try to pass the null valued parameter to the reports, I get no data back. If both parameters are populated I DO get the expected data. When stepping through the code in Visual Studio I see that whenever BusinessObjects returns a null valued parameter it displays as an empty string (""). I have tried passing this as a parameter value and have also tried assigning the parameter a value of null. Neither of these options returns results once the report is scheduled and run. I have an example of my parameter assignment code below using each of the approaches that I've taken (We need to check for a string valued "null" as the user's have requested the ability to type "null" and have that passed to the report). None of these produce a report that contains data.
sVal.Value = param.ParameterValue != "null" ? param.ParameterValue : String.Empty;
sVal.Value = param.ParameterValue != "null" ? param.ParameterValue : "";
sVal.Value = param.ParameterValue != "null" ? param.ParameterValue : null;
Is there a specific value that the Enterprise Server uses to indicate null, such as dates are required to be wrapped in Date()?
Edit: The functionality I need to duplicate as seen in InfoView:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Web Intelligence 中,默认情况下所有提示都是必需的,并且您必须通过 SDK 为其提供一个值。从 BusinessObjects XI R3 开始,实际上可以将报表中的提示配置为可选。此配置由报告编写者完成。如果提示是可选的,那么您可以选择在使用 SDK 时不设置提示值。
提供可选提示的另一种方法是使提示“匹配模式”,或者如果它是日期,则找出默认值。当提示是可选的并且是“在列表中”时,您可以将值设置为“%”,而对于日期,则设置默认值。
In Web Intelligence, by default all prompts are required and you must provide a value for it via the SDK. As of BusinessObjects XI R3 it is possible to actually configure the prompt in the report to be optional. This configuration is done by the report writer. When the prompt is optional then you can opt to not set the prompt value when working with the SDK.
An alternate way to have an optional prompt is to make the prompt "matches pattern" or if it is a date, figure out a default value. When the prompt is meant to be optional and is "in list" then you can set the value to be "%" which, while for a date, set the default value.