将参数传递给Crystal Report子报表中的存储过程?

时间:2021-12-06 16:38:52

I have a Crystal Report, that is populated with a stored procedure, it also contains a sub report, that I am trying to populate with another stored procedure ... same parameters. I cannot figure out how to pass the parameter value to the sub report.

我有一个Crystal Report,它填充了一个存储过程,它还包含一个子报告,我试图用另一个存储过程填充...相同的参数。我无法弄清楚如何将参数值传递给子报告。

Any help would be appreciated!

任何帮助,将不胜感激!

4 个解决方案

#1


When you add the stored proc to the sub-report CR will add the parameters automatically. Then when you set up the sub-report links you link the main report parameters to the sub-report parameters.

将存储过程添加到子报表CR时,将自动添加参数。然后,在设置子报告链接时,将主报告参数链接到子报告参数。

#2


I understand this question is old but I didn't find any satisfactory answers to this. The simple solution I found is to implement the stored procedure from within a crystal command just like any other command sql. I could not get the parameters to show up in the bottom left drop downs no matter what. Something similar to below where ZNG_PROACTIVE_STREET_SWEEPS is the name of the stored procedure and the two parameters are what the stored procedure takes in.

我知道这个问题已经过时但我没有找到任何令人满意的答案。我发现的简单解决方案是在crystal命令中实现存储过程,就像任何其他命令sql一样。无论如何,我都无法将参数显示在左下角的下拉列表中。类似于下面的内容,其中ZNG_PROACTIVE_STREET_SWEEPS是存储过程的名称,两个参数是存储过程所接受的内容。

[dbo].[ZNG_PROACTIVE_STREET_SWEEPS] @StartDate ={?begindate}, @EndDate = {?enddate}

[dbo]。[ZNG_PROACTIVE_STREET_SWEEPS] @StartDate = {?begindate},@ EndDate = {?enddate}

#3


Sounds all so simple, but unfortuanate it isn't that simple. I can link the parameters from main to sub -report, no problem. But when it comes to feeding it to the subreport procedure parameters it becomes rather difficult.

听起来很简单,但不幸的是,并非那么简单。我可以将参数从main链接到子报告,没问题。但是,当涉及将其提供给子报告程序参数时,它变得相当困难。

I'm using Crystal XI. Same procedure main and subreport. The aim is to let the user select the parameters only once. Currently, the user needs to select the parameters for both main and sub report.

我正在使用Crystal XI。相同的过程主要和子报告。目的是让用户只选择一次参数。目前,用户需要为主报告和子报告选择参数。

Ok, I over-read the comment where to find the dropdown. The drop down is in the screen subreport links. On the botton there are 2 dropdowns, use the one on the left.

好的,我过度阅读评论在哪里找到下拉列表。下拉列表位于屏幕子报表链接中。在底部有2个下拉菜单,使用左边的那个。

#4


You can pass value to sub report like this:

您可以将值传递给子报告,如下所示:

oRpt.SetParameterValue("@InvNo", Session("InvoiceNo"), "rptInvoicePrintSub") ' parameter for subreport

#1


When you add the stored proc to the sub-report CR will add the parameters automatically. Then when you set up the sub-report links you link the main report parameters to the sub-report parameters.

将存储过程添加到子报表CR时,将自动添加参数。然后,在设置子报告链接时,将主报告参数链接到子报告参数。

#2


I understand this question is old but I didn't find any satisfactory answers to this. The simple solution I found is to implement the stored procedure from within a crystal command just like any other command sql. I could not get the parameters to show up in the bottom left drop downs no matter what. Something similar to below where ZNG_PROACTIVE_STREET_SWEEPS is the name of the stored procedure and the two parameters are what the stored procedure takes in.

我知道这个问题已经过时但我没有找到任何令人满意的答案。我发现的简单解决方案是在crystal命令中实现存储过程,就像任何其他命令sql一样。无论如何,我都无法将参数显示在左下角的下拉列表中。类似于下面的内容,其中ZNG_PROACTIVE_STREET_SWEEPS是存储过程的名称,两个参数是存储过程所接受的内容。

[dbo].[ZNG_PROACTIVE_STREET_SWEEPS] @StartDate ={?begindate}, @EndDate = {?enddate}

[dbo]。[ZNG_PROACTIVE_STREET_SWEEPS] @StartDate = {?begindate},@ EndDate = {?enddate}

#3


Sounds all so simple, but unfortuanate it isn't that simple. I can link the parameters from main to sub -report, no problem. But when it comes to feeding it to the subreport procedure parameters it becomes rather difficult.

听起来很简单,但不幸的是,并非那么简单。我可以将参数从main链接到子报告,没问题。但是,当涉及将其提供给子报告程序参数时,它变得相当困难。

I'm using Crystal XI. Same procedure main and subreport. The aim is to let the user select the parameters only once. Currently, the user needs to select the parameters for both main and sub report.

我正在使用Crystal XI。相同的过程主要和子报告。目的是让用户只选择一次参数。目前,用户需要为主报告和子报告选择参数。

Ok, I over-read the comment where to find the dropdown. The drop down is in the screen subreport links. On the botton there are 2 dropdowns, use the one on the left.

好的,我过度阅读评论在哪里找到下拉列表。下拉列表位于屏幕子报表链接中。在底部有2个下拉菜单,使用左边的那个。

#4


You can pass value to sub report like this:

您可以将值传递给子报告,如下所示:

oRpt.SetParameterValue("@InvNo", Session("InvoiceNo"), "rptInvoicePrintSub") ' parameter for subreport