按 SSRS 2005 中的报告项目分组 - 文本框 - 有解决方法吗?
我想按报告项目进行分组,但这是不允许的。 所以我尝试创建一个参数......也不允许。 尝试从页脚引用...再次失败。
这有点复杂。 让我解释一下:
我有textbox22,它的值是:
=Code.Calc_Factor(Fields!xx.Value, fields!yy.Value...)
这是报告中嵌入的VB代码,为每一行调用以计算标准因子。
现在,为了计算与标准因子的偏差,我使用 textbox89,其值为:
=(Fields!FACTOR.Value - ReportItems!textbox22.Value)/ReportItems!textbox22.Value
不要混淆 Fields!FACTOR.Value
和 textbox22.Value
,它们是不同的。 Fields!FACTOR.Value
是使用的因子,textbox22.Value
是它应该是的(标准因子)。
现在我想创建一个组,将偏差分为 2 组,> 1% 或没有。 所以我尝试创建一个组:
=IIF(ReportItems!textbox89.Value > 1,0,1)
...但是随后 SSRS 抱怨使用报告项目。
我过去在使用报告项目时遇到过类似的问题,但这是一个新案例!
非常感谢任何帮助。
I want to group by a report item, but that's not allowed.
So I tried creating a parameter...not allowed as well.
Tried referencing from footer...failed again.
This is somewhat complicated.
Let me explain:
I have textbox22, it's value is:
=Code.Calc_Factor(Fields!xx.Value, fields!yy.Value...)
This is embedded VB code in the report that's called for each row to calculate a standard factor.
Now to calculate the deviation from the standard factor, I use textbox89, whose value is:
=(Fields!FACTOR.Value - ReportItems!textbox22.Value)/ReportItems!textbox22.Value
Don't get confused between Fields!FACTOR.Value
and textbox22.Value
, they are different.Fields!FACTOR.Value
is the factor used, textbox22.Value
is what it should be (standard factor).
Now I want to create a group which splits deviations into 2 groups, > 1% or not.
So I tried creating a group:
=IIF(ReportItems!textbox89.Value > 1,0,1)
...But then SSRS complains about using report items.
I have run into a similar problem of using report items in the past, but this is a new case!
Any help greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过向数据集中添加计算字段?
它的工作原理如下:
当您处于报表的布局视图中时,打开“数据集”工具窗口(在我的环境中它位于左侧)。
右键单击您正在使用的数据集并添加一个字段,您可以使用计算字段,并适当地构建您的公式
然后您应该能够在此字段上进行分组
-担
Have you tried adding a calculated field to your dataset?
Here is how it works:
While you are in the layout view of the report, open "datasets" tool window(in my environment it is on the left).
Right click on the DataSet you are working with and add a field, you can use a calculated field, and build your formula appropriately
Then you should be able to group on this field
-Dan
我并不是 100% 认为有人不会为此找到一些神奇的解决方案,但我自己过去也遇到过类似的问题。 我相信(但可能是错误的)Reporting Services 遇到的问题是它只渲染一次,而您要求它做的是在渲染分组之前渲染数据,而它不这样做。
我能够产生所需的准确结果的唯一方法是使数据呈现仅在 SQL 中进行(通常通过使用表变量),然后仅使用 Reporting Services 作为显示平台。 这将要求您的因式分解算法在您可能需要编写的存储过程中的 T-SQL 中表达,以获取数据的形状。 这似乎是实现最终结果的唯一方法。
这样做的好处是可以将报告设计和演示与数据操作分开。
抱歉,我无法提供 SSRS 解决方案,也许其他人会知道更多。
I'm not 100% that someone won't have some magic solution for this but I have run across similar problems myself in the past. I believe (but could be wrong) the problem Reporting Services is having is that it only renders once and what you're asking it to do is render the data before rendering the grouping which it doesn't do.
The only way I have ever been able to produce the exact results I need is to make the data rendering happen exclusively in the SQL (through the use of table variables usually) and then use Reporting Services merely as a display platform. This will require that your factoring algorithm gets expressed in the T-SQL within the stored procedure you will likely have to write to get the data in shape. This would appear to be the only way to achieve your end result.
This has the bonus feature of separating report design and presentation from data manipulation.
Sorry I couldn't provide a SSRS solution, maybe someone else will know more.