简体   繁体   English

水晶报表中的级联参数和多个日期

[英]Cascading parameter and multiple dates in Crystal report

I am trying to create a report in Crystal (2011, V14.0), the results displayed are not consistent with the idea, I feel like the below code should work but no avail, any clue is appreciated! 我正在尝试在Crystal(2011,V14.0)中创建报告,显示的结果与想法不符,我觉得下面的代码应该可行,但无济于事,不胜枚举! requires a 1) user to select Cluster and then based on that (Think it like Country) 2) The other parameter gets Facility names filtered for that Cluster (Think it like State) 要求1)用户选择集群,然后基于该集群(像国家一样思考)2)另一个参数获取为该集群过滤的设施名称(像州一样思考)

Now, Cluster should be mandatory and if user doesn't select any facility then it should consider displaying all facilities in that user specified Cluster. 现在,群集应该是强制性的,如果用户未选择任何功能,则它应考虑显示该用户指定的群集中的所有功能。

On the top of this there are four date field in table, if any of these dates falls between users selected date range then it should select them as well. 在表格的顶部,有四个日期字段,如果这些日期中的任何一个介于用户选择的日期范围之间,则也应选择它们。 So, I am using this formula 所以,我正在使用这个公式

if (not HasValue({?FacilityNameVW})) then
{Cmd_PWCode_Shop.DESCRIPTION} = {?FacilityNameVW - DESCRIPTION}  and 
({WORKORDER.ACTUALSTARTDATE} in {?From Date} to {?To Date}  or
{WORKORDER.ACTUALFINISHDATE} in {?From Date} to {?To Date} or
{WORKORDER.PROJSTARTDATE}in {?From Date} to {?To Date} or
{WORKORDER.PROJFINISHDATE}in {?From Date} to {?To Date} ) 
else
(HasValue({?FacilityNameVW}) OR {Cmd_WO_Shop_Facility.FACILITYNAME} = {?FacilityNameVW}) and
({WORKORDER.ACTUALSTARTDATE} in {?From Date} to {?To Date}  or
{WORKORDER.ACTUALFINISHDATE} in {?From Date} to {?To Date} or
{WORKORDER.PROJSTARTDATE}in {?From Date} to {?To Date} or
{WORKORDER.PROJFINISHDATE}in {?From Date} to {?To Date} )

And here is screenshot of the the Parameters setting in Crystal 2011, V14.0 here is screenshot of the Parameters setting in Crystal 2011, V14.0 这是Crystal 2011 V14.0 中的Parameters设置的屏幕截图这是 Crystal 2011 V14.0 中的Parameters设置的屏幕截图

The problem is solved now. 现在问题已解决。 At the first, I realized the report skips after executing first conditional statement on if test date in from to To then xx, It doesn't execute the other condition on other different dates, But on other reports with different data with multiple dates it was working fine. 首先,我意识到在执行第一个条件语句(测试日期是否从to至xx)后,报表将跳过,它不在其他不同日期执行其他条件,但是在其他具有多个日期的数据的报表中,工作正常。 Finally, somehow my links and tables and views in Data experts were creating Cartesian product and so, everything was going crazy. 最后,以某种方式,我在数据专家中的链接,表格和视图正在创建笛卡尔积,因此一切都变得疯狂。

I created a new View in SQL, minimizing number of links and then used a parameterized SQL command to pull data filtered on four different fields and on top of it. 我创建了一个新的SQL视图,以最大程度地减少链接数,然后使用参数化的SQL命令提取在四个不同字段及其上方过滤的数据。 I added logic in Select expert to handle Country and City. 我在选择专家中添加了处理国家和城市的逻辑。 Now it works fine. 现在工作正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM