简体   繁体   中英

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! 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)

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

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. 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. I added logic in Select expert to handle Country and City. Now it works fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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