Print Page | Close Window

Suppress section help needed

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=17926
Printed Date: 28 Apr 2024 at 10:55pm


Topic: Suppress section help needed
Posted By: Zuzanna
Subject: Suppress section help needed
Date Posted: 05 Nov 2012 at 10:57am

Hi,

I have a report calculating consecutive sick time.  If sick time has been coded more than once in 21 days, I flag the row on the report.

The report may look as follow

 

Employee ID      Name               Date Worked     Consecutive Sick Time

100                         John Doe          2012/08/13

200                         Jim Test            2012/09/21

300                         Jane Test2       2012/10/13

300                         Jane Test2       2012/11/01         **

400                         John Test3       2012/09/29

400                         John Test3       2012/10/28

500                         Jane Test4       2012/09/16

500                         Jane Test4       2012/09/25         **

 

I’d like to change the report to only print employees who have been flagged as follow

 

Employee ID      Name               Date Worked     Consecutive Sick Time

300                         Jane Test2       2012/10/13

300                         Jane Test2       2012/11/01         **

500                         Jane Test4       2012/09/16

500                         Jane Test4       2012/09/25         **

 

I set up suppress detail section formula

 

Next({HRIS_SNI_SICK_TCODE1.LHS_WB_EMP_NAME}) <> {HRIS_SNI_SICK_TCODE1.LHS_WB_EMP_NAME} and

{@Consecutive_Sick} = " "

 

It doesn’t work, I can only suppress where {@Consecutive_Sick} = " " and I lose ie.

 

Employee ID      Name               Date Worked     Consecutive Sick Time

300                         Jane Test2       2012/10/13

 

Is there a way to do it ? Thanks in advance.



Replies:
Posted By: Sastry
Date Posted: 05 Nov 2012 at 6:20pm
Hi
 
--Create a group on Employee ID
--Insert a summary on on Consecutive Sick Time (Maximum) and place the summary on group header
 
--Go in Report Menu --Group--then give the following condition :
 
Maximum( mailto:%7b@Consecutive_Sick%7d,%7bEmployee - {@Consecutive_Sick},{Employee ID} = "**"   
 
--Suppress Group header and group footer.


-------------
Thanks,
Sastry


Posted By: Zuzanna
Date Posted: 06 Nov 2012 at 3:02am
Thanks, mailto:%7b@Consecutive_Sick - {@Consecutive_Sick } is a formula and I cannot insert Summary for this field. I would also like to print all rows for an employee if one of the rows contains '**'.


Posted By: DBlank
Date Posted: 06 Nov 2012 at 3:48am
can you use a stored procedure or some other source to get your data set here? I assume you are creating your "Consecutive sick" by using a next() or previous() function which will preclude you from being able to conditionally supress rows in the group that occurred prior to the row thjat "finds any consecutive day".


Posted By: Zuzanna
Date Posted: 06 Nov 2012 at 4:47am
Hi,
 
this is my mailto:%7B@Consecutive_Sick - {@Consecutive_Sick }  formula
 
If not PreviousIsNull({HRIS_SNI_SICK_TCODE1.LHS_WB_EMP_NAME}) Then
   If Previous({HRIS_SNI_SICK_TCODE1.LHS_WB_EMP_NAME}) = {HRIS_SNI_SICK_TCODE1.LHS_WB_EMP_NAME} Then  //not first record     
      If DateDiff("d", previous({HRIS_SNI_SICK_TCODE1.LHS_WB_WORK_DATE}), {HRIS_SNI_SICK_TCODE1.LHS_WB_WORK_DATE}) <= 21 Then
         "**"
      Else
         " "
   Else
       " "
Else
     " "
It works ok to flag the rows, but if I suppress the detail section where
 
mailto:%7B@Consecutive_Sick - {@Consecutive_Sick } = " "
 
I also suppress the first row of my group that has blank in the flag and  contains the '**' flag. It would be nice to see it because it shows the first work date marked with Sick Time.
 
Thanks.


Posted By: DBlank
Date Posted: 06 Nov 2012 at 5:29am
your formula is about what I would have expected.
The problem you are going to have is how crystal does things in data asses. You have to calculate this formula in such a late pass that you cannot use the result (not being able to summarize it) to suppress eiterha group or a row that is printed above the result.
This si why I was suggesting tio try and get your result in your source via a command or a stored proc.
Are either of these available to you?


Posted By: Zuzanna
Date Posted: 06 Nov 2012 at 6:01am
I have never used either. We're on Oracle database and I pass data to crystal through PeopleSoft query.


Posted By: DBlank
Date Posted: 06 Nov 2012 at 8:21am
The only thing I can think of would be to use sub report at the group header
I hate to use them if you can avoid them as they can really bog performance down but...
put a sub report in the group header 1A (linking on employee id),
use it check to see if the group meets the condition as a whole
return a shared variable of True / False or Yes/No in a GH1B
use this to suppress/show GH1C and details section which is what you have now.
 
You can suppress all of the fields in the sub report,
conditionally suppress the sub report when blank and then suppress group header1 when blank
you cannot suppress the sub report striaght out or it will not run


Posted By: Zuzanna
Date Posted: 06 Nov 2012 at 8:45am
Oh boy, I'll try. Thanks for your help.



Print Page | Close Window