Crystal Reports - 将参数添加到“Command”查询 [英] Crystal Reports - Adding a parameter to a 'Command' query
问题描述
水晶版本 - Crystal Reports 2008
Business Objects - XI
我写了一个查询来填充子报表,基于来自用户的输入进行查询。我的问题是,我需要放在'Where'子句的第一行接受参数是什么正确的语法?
这里是我使用的查询在水晶报表中:
选择
Projecttname,
ReleaseDate,
TaskName
从DB_Table
其中
(Project_Name如{?Pm-?Proj_Name}))和
(ReleaseDate)> = currentdate
我想出的解决方案如下:
将子报表添加到主报表中后,右键单击子报表,选择更改子报表链接...,选择链接字段,然后取消选中在子报表中选择数据 '
注意:您可能必须首先添加参数,并在基于字段的子报表中选择数据:选中,然后返回到更改子报表链接
(子报表SQL列)(来自主报表的参数)
示例:{Command.Project} like {?Pm-?Proj_Name}
Crystal Version - Crystal Reports 2008 Business Objects - XI
I have written a query to populate a subreport and want to pull in a parameter to that query based on input from a user. My question is, what is the correct syntax I need to put in the first line of the 'Where' clause to accept the parameter?
Here is the query I am using in Crystal Reports:
Select
Projecttname,
ReleaseDate,
TaskName
From DB_Table
Where
(Project_Name like {?Pm-?Proj_Name})) and
(ReleaseDate) >= currentdate
The solution I came up with was as follows:
- Create the SQL query in your favorite query dev tool
- In Crystal Reports, within the main report, create parameter to pass to the subreport
- Create sub report, using the 'Add Command' option in the 'Data' portion of the 'Report Creation Wizard' and the SQL query from #1.
Once the subreport is added to the main report, right click on the subreport, choose 'Change Subreport Links...', select the link field, and uncheck 'Select data in subreport based on field:'
NOTE: You may have to initially add the parameter with the 'Select data in subreport based on field:' checked, then go back to 'Change Subreport Links ' and uncheck it after the subreport has been created.
In the subreport, click the 'Report' menu, 'Select Expert', use the 'Formula Editor', set the SQL column from #1 either equal to or like the parameter(s) selected in #4.
(Subreport SQL Column) (Parameter from Main Report) Example: {Command.Project} like {?Pm-?Proj_Name}
这篇关于Crystal Reports - 将参数添加到“Command”查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!