您可以轮流浏览报表生成器3中的可见子报表吗? [英] Can you rotate through visible sub reports in report builder 3?

查看:88
本文介绍了您可以轮流浏览报表生成器3中的可见子报表吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个主要报告和几个子报告.本质上,我希望轮流显示每个子报表大约30秒钟,然后隐藏第一个子报表,然后显示下一个并在所有时间都用完之后重新启动.

I have one main report with several sub reports. Essentially I want to show each sub report in rotation for about 30 seconds before hiding the first one then showing the next and restarting again after all have had their time up.

谢谢

推荐答案

我认为"可以做到这一点,但有一些警告.

I 'think' you can do this, but there are some caveats.

您将需要设置一个数据库表来存储当前循环位置,如果您有多个报告,则可以将其键入报告名称.

You will need to setup a database table to store the current loop position, if you have several of these reports you could key it on report name for example.

(请注意,这些名称用于主报表,与子报表无关)

(note these names are for the main report, nothing to do with the subreports)

ReportName     LoopPosition LoopMax
MyMainReportA        0         3
AnotherReport        7        10 

将数据集(简称为dsLoop)添加到主报告中,该数据集将更新此值并以类似方式返回. (未经测试)

Add a dataset (lets call it dsLoop) to your main report that updates this value and returns it with something like. (Untested)

DECLARE @LoopPosition int
SELECT @LoopPosition =  CASE LoopPosition WHEN LoopMax THEN 1 ELSE LoopPosition + 1 END
    FROM myReportLoopTable 
    WHERE ReportName = 'MyMainReportA'

    UPDATE myReportLoopTable Set LoopPosition = @LoopPosition WHERE ReportName = 'MyMainReportA'

SELECT @LoopPosition as LPos

此代码仅将1添加到LoopPosition或将其重置为1(如果我们达到最大值).然后返回该值.

This code simply adds 1 to the LoopPosition or resets it to 1 if we've hit the maximum value. It then returns this value.

现在将参数pLoopPos添加到主报表中(这可以是隐藏参数),并将其默认值设置为新的dsLoop数据集.

Now add a parameter pLoopPos to your main report (this can be a hidden parameter) and set it default value to our new dsLoop dataset.

现在将每个子报表的hidden属性更改为仅在Parameters!pLoopPos.Value = x时显示子报表,其中x是子报表的顺序.

Now change the hidden property of each subreport to only show the subreport when Parameters!pLoopPos.Value = x where x is the order of the subreport.

现在,当报表运行时,它将更新循环位置并获取新值.第一个子报表将显示为pLoopPos将为1.当报表刷新时(通过AutoRfresh属性),将重新评估dsLoop数据集,这将运行代码以更新值. pLoopPos值将增加,并显示下一个子报告.

Now, when the report runs it will update the loop position and get the new value. The first subreport will show as the pLoopPos will be 1 . When your report refreshes (via the AutoRfresh property) the dsLoop dataset will be reevaluated which will run the code to update the value. The pLoopPos value will increase and the next subreport will be displayed.

您可能必须强制始终从参数属性刷新参数.

You may have to force the parameter to always be refreshed (from the parameter properties).

请注意,此内容未经测试.这只是我的主意,因此我建议您先花一个简单的测试报告,然后再花太多时间尝试实施它.

PLEASE NOTE THIS IS UNTRIED AND UNTESTED. This is just off the top of my head so I suggest a simple test report before spending too much time trying to implement it.

更新时间:2018-04-10 在您的后续问题中,使用参数似乎无法正常工作,因为它没有刷新.但是,您可以使用dsLoop直接返回的值.要进行更改,只需换出

UPDATE: 2018-04-10 Following on from your followup question, it looks like using the parameter wont work as it does not get refreshed. However you can use the value the dsLoop returns directly. To make the change, simply swap out

Parameters!pLoopPos.Value=First(Fields!LPos.Value, "dsLoop")

注意:我对dsLoop查询做了一些修改,为最终结果指定了名称(LPos).

Note: I modified the dsLoop query slightly to give the final result a name (LPos).

您现在应该可以删除不再使用的参数.

You should now be able to delete the parameter as its no longer used.

这篇关于您可以轮流浏览报表生成器3中的可见子报表吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆