Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Minimum and maximum function. Post Reply Post New Topic
Author Message
andrewsimon
Newbie
Newbie
Avatar

Joined: 28 Jun 2011
Online Status: Offline
Posts: 26
Quote andrewsimon Replybullet Topic: Minimum and maximum function.
    Posted: 16 Aug 2011 at 11:51pm
I want to display first in last out of employee per day in crystal report.
The problem is that ,the IN and OUT entry is identified by the reader,
ie,
READER=1 for  IN entry
REDER=2 for the Out entry
 
I'm using this formulas for the first in and last out
 
DateTimeVar Time1 :=minimum({EVENTS.EVENT_TIME_UTC},{@EDATE});
 
DateTimeVar Time1 :=maximum({EVENTS.EVENT_TIME_UTC},{@EDATE});
the problem is that ,there is no way to identify,the value is correct for
Entry and exit.
some times,the maximum({EVENTS.EVENT_TIME_UTC},{@EDATE}) is occured in the READER=1
Is there any way to find, the minimum time for REDER=1
and
Maximum Time for READER =2
 
 
 
bbbbb
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 17 Aug 2011 at 2:26am
as long as you are not grouping on it, and the results can go in the group footer...
 
formulas with shared variables, something like:
(detail section - incrementor)
shared datetimevar dtIn;
shared datetimevar dtOut;
 
if dtIn > {table.timeField} and {table.reader} = 1 then
   dtIn := {table.timeField};
 
if dtOut < {table.timeField} and {table.reader} = 2 then
   dtOut := {table.timeField};
 
"" //hides the output
 
group footer - display:
2 formulas
shared datetimevar dtIn;
dtIn
 
shared datetimevar dtOut;
dtOut
 
group header - reset...
it's really just about setting the initial values to be opposites of the what you want...
shared datetimevar dtIn := "12/31/2200";
shared datetimevar dtOut := "1/1/2000";
"" //again to hide the output
 
HTH
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Aug 2011 at 4:08am
As Lockwelle knows I prefer Running Totals to Variable formuals so I will give you that version as well.
 
You can use a conditional formula to tell it which records to evaluate
 You will need 2 RTs
 
Name = Min_In
Field to summarize=EVENTS.EVENT_TIME_UTC
Type of Summary = Minimum
Evaluate= use a formula
table.READER=1
reset= on Change of Group @Edate (this is based on how you wrote your code above)
place in group Footer (Rts do not work in headers)
 
Name = Max_Out
Field to summarize=EVENTS.EVENT_TIME_UTC
Type of Summary = MAximum
Evaluate= use a formula
table.READER=2
reset= on Change of Group @Edate (this is based on how you wrote your code above)


Edited by DBlank - 17 Aug 2011 at 4:09am
IP IP Logged
andrewsimon
Newbie
Newbie
Avatar

Joined: 28 Jun 2011
Online Status: Offline
Posts: 26
Quote andrewsimon Replybullet Posted: 18 Aug 2011 at 1:17am
Thank you Dblank.It is working perfectly.....
bbbbb
IP IP Logged
rami
Newbie
Newbie


Joined: 13 Jan 2012
Location: Saudi Arabia
Online Status: Offline
Posts: 2
Quote rami Replybullet Posted: 13 Jan 2012 at 8:47am
Hi Andrewsimon

i guess i have the same lenel system which you succeed to create this report may i ask you to help me creating this report but i need to get the first in and last out from all readers
IP IP Logged
andrewsimon
Newbie
Newbie
Avatar

Joined: 28 Jun 2011
Online Status: Offline
Posts: 26
Quote andrewsimon Replybullet Posted: 15 Jan 2012 at 1:26am
You just omit the condition table.Reader.
bbbbb
IP IP Logged
rami
Newbie
Newbie


Joined: 13 Jan 2012
Location: Saudi Arabia
Online Status: Offline
Posts: 2
Quote rami Replybullet Posted: 19 Apr 2012 at 9:14am
HI,

its not working yet, please can you copy and paste your code here
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.