Reporting Services - 将数据放入子报表中
我的任务是使用 Reporting Services 2008 报告调查数据。
是:
- 调查有任意数量的问题,
- 问题是三种类型之一(数值评估、是/否问题或自由文本)
我的挑战 处理这个问题,我决定在我的主报告上使用子报告,例如,我为三种问题类型中的每一种定义了一个报告,现在当我报告一项调查时,我基本上动态地为调查报告创建一个 RDL,使用三种问题类型作为子报告。
到目前为止,这实际上工作得很好 - 但我面临一个主要问题:如何将数据放入子报表中?
我现在看到的方法是让每个问题类型的每个(子)报告基于共享数据源定义自己的数据集,以从数据库中提取值。我很确定这会起作用 - 但我不太热衷于将 5、10、20 个子报告发送到数据库以独立获取数据。
我所希望的是能够在整个调查的“主”报告中获取一次数据,然后在渲染时将适当的数据子集输入到每个子报告中 - 但我似乎做不到找到任何方法来做到这一点......
我是否错过了一些完全明显的东西?我对 Reporting Services 的接触不多,我上一次使用它的项目是四年前(Reporting Services 2000) - 所以很有可能我对明显的解决方案视而不见:-) 请告诉我!
感谢您提供任何提示、有关 Reporting Services 的好文章或博客的提示以及任何帮助!
马克
I'm tasked with reporting on survey data using Reporting Services 2008.
My challenge is this:
- a survey has any number of questions
- a question is one of three types (a numerical eval, a yes/no question, or a free text)
To handle this, I decided to use subreports on my main report, e.g. I defined one report for each of the three question types, and now when I'm reporting on a survey, I basically dynamically create a RDL for the survey report, using the three question types as subreports.
That actually works quite nicely so far - but I'm facing one major problem: how do I get the data into the subreports?
The approach I see right now is to have each (sub)report per question type define its own data set, based on a shared data source, to extract the values from the database. I'm pretty sure this would work - but I am not very keen on having potentially 5, 10, 20 subreports going off to the database to get their data independently.
What I was hoping for was being able to go fetch the data once for the whole survey, on the "main" report, and then just feed the appropriate subset of data into each subreport, as its being rendered - but I can't seem to find any way to do this....
Am I missing something totally obvious? I haven't had much exposure to Reporting Services, and my last project with it was four years ago (with Reporting Services 2000) - so there's a good chance I am just blind for the obvious solution :-) Please let me know!
Thanks for any hints, pointers to good articles or blogs on Reporting Services, and any help at all!
Marc
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
通常的方法是将参数(如日期范围)从主报表传递到子报表,然后子报表负责处理其他所有事情。要提高性能,请查看是否可以从缓存或快照呈现子报表。缓存存储带有传递的参数组合的报告,因此在第一次“数据库命中”之后,某些或大多数子报告实际上可能会从缓存返回。
The usual way is to pass parameters (like date range) from main report to subreports and then subreports take care of everything else. To improve performance, see if you can render subreports from cache or snapshot. The cache stores report with combination of parameters passed, so after first "database hit" some or most subreports may actually be returned from the cache.
我遇到了同样的问题。但是有一种方法可以使用“缓存共享数据集”获得合理的性能。基本上子报表将使用更大的数据集,包括所有子报表的所有行。通过使用“数据集过滤器”,每个子报表都可以正确过滤掉行。
然而,这仅适用于 2008 版本。
I struggled with the same issue. But there is a way you can achieve reasonable performance using "cached shared dataset". Basically subreports will use larger dataset including all rows for all subreports. By using "dataset filter" each subreport can filter out rows properly.
This is only available for 2008 version however.
如果参数是您需要的最终数据,那么只需使用它们并在子报表中创建一个虚拟数据集 - 您可以将“SELECT 1 AS DUMMY”作为 sql(假设子报表彼此具有不同的布局)
或者也许您可以使用函数或表函数重新考虑“主”数据集?
它仍然会对 sql 服务器造成负担,但至少它会一次性完成,并且 RS 盒上的消耗会更少。
If the parameters are the final data you require, then just use them and create a dummy dataset in the subreport - you could just have 'SELECT 1 AS DUMMY' as the sql (this is assuming that the subreports have distinct layouts from one another)
Or perhaps you can rethink the 'master' dataset with a function or table function?
It would still tax the sql server, but at least it would be doing it in one hit and the drain on the RS box would be less.