Print Page | Close Window

Conditional Formatting

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=16053
Printed Date: 02 May 2024 at 9:19pm


Topic: Conditional Formatting
Posted By: Winfield
Subject: Conditional Formatting
Date Posted: 30 Mar 2012 at 7:24am
Hello all,
 
I am trying to create a report that shows how many High and Critial Incidents gets logged after hours.  While I am able to create the report showing me ALL the High and Critical Incidents, I only need the ones that are after hours (between 5pm and 5am) and on Weekends.
 
I figure I can use conditional formatting to filter out High and Critical Incidents logged during business hours (5am -5pm, M-F), but so far I am unable to think of a way to do that.  Any suggestions?
 
Thanks.



Replies:
Posted By: rkrowland
Date Posted: 01 Apr 2012 at 11:46pm
This is a formula I use to determine how much work people do during overtime hours, you can use the same princinple to get what you need;
 
Numbervar array wkdystart:= [0, 9, 9, 9, 9, 9, 0];
numbervar array lunchstart:=
    if {Command.BaseUserName} in ["Ryan Rowland"]
        then [0, 12, 12, 12, 12, 12, 0]
    else if {Command.BaseUserName} in ["Emma Hall"]
        then [0, 12.30, 12.30, 12.30, 12.30, 12.30, 0]
   
    else[0, 13, 13, 13, 13, 13, 0];
numbervar array lunchend:=
    if {Command.BaseUserName} in ["Ryan Rowland"]
        then [0, 13, 13, 13, 13, 13, 0]
    else if {Command.BaseUserName} in ["Emma Hall"]
        then [0, 13.30, 13.30, 13.30, 13.30, 13.30, 0]
    else [0, 14, 14, 14, 14, 14, 0];
numbervar array wkdyend:= [0, 17, 17, 17, 17, 17, 0];
if dayofweek({Command.TimeStamp}) in [7,1]
then "Weekend"
else if mailto:%7b@Hour - {@Hour } = 1
then "Time Unknown"
else if mailto:%7b@Hour - {@Hour }  < wkdystart[dayofweek({Command.TimeStamp})]
Then "Morning OT"
else if mailto:%7b@Hour - {@Hour }>= wkdyend[dayofweek({Command.TimeStamp})]
then "Evening OT"
else if ( mailto:%7b@Hour - {@Hour }>= lunchstart[dayofweek({Command.TimeStamp})] and mailto:%7b@Hour - {@Hour }< lunchend[dayofweek({Command.TimeStamp})])
then "Lunch OT"
else if ( mailto:%7b@Hour - {@Hour }>= wkdystart[dayofweek({Command.TimeStamp})] and mailto:%7b@Hour - {@Hour }< lunchstart[dayofweek({Command.TimeStamp})])
then "NT AM"
else if ({@Hour}>=lunchend[dayofweek({Command.TimeStamp})] and mailto:%7b@Hour - {@Hour }< wkdyend[dayofweek({Command.TimeStamp})])
then "NT PM"
else "Time Unknown"
 
Your formula shouldn't need to be as complex as that as I'm guessing you don't need to take into consideration lunch hours nor individual people who work different hours.
 
Regards,
Ryan.



Print Page | Close Window